The forum of the forums
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Housepoint Hourglass

3 posters

Go down

Solved Housepoint Hourglass

Post by Elisabeth McNight October 27th 2015, 9:14 pm

My forum is a Harry Potter/Hogwarts based forum, where people can take classes, etc. What I want to do, is add in the housepoints hourglass to a forum thread without having to constantly edit it. I would like for it to show up as a table, each house being the header, and beneath that, the points for each house. Points would be added or subtracted by admin and mods by a click of a button.

Is it possible to do this? And if so, how?


Last edited by Elisabeth McNight on October 31st 2015, 5:40 pm; edited 1 time in total
Elisabeth McNight
Elisabeth McNight
New Member

Female Posts : 22
Reputation : 2
Language : English

http://hogwartsswwroleplay.forumotion.com/

Back to top Go down

Solved Re: Housepoint Hourglass

Post by Elisabeth McNight October 29th 2015, 12:44 am

Bump
Elisabeth McNight
Elisabeth McNight
New Member

Female Posts : 22
Reputation : 2
Language : English

http://hogwartsswwroleplay.forumotion.com/

Back to top Go down

Solved Re: Housepoint Hourglass

Post by Ange Tuteur October 29th 2015, 9:41 am

Hi @Elisabeth McNight,

It is possible to a degree, but it would take quite a bit of JavaScript to setup. Could you provide an example, such as a link to the thread or its post contents ? ( bbcode, text.. )
Ange Tuteur
Ange Tuteur
Forumaster

Male Posts : 13246
Reputation : 3000
Language : English & 日本語
Location : Pennsylvania

https://fmdesign.forumotion.com

Back to top Go down

Solved Re: Housepoint Hourglass

Post by Elisabeth McNight October 29th 2015, 11:45 pm

If you mean an example where it's already been done, no I can't, I don't know where nor if it has been done.
Elisabeth McNight
Elisabeth McNight
New Member

Female Posts : 22
Reputation : 2
Language : English

http://hogwartsswwroleplay.forumotion.com/

Back to top Go down

Solved Re: Housepoint Hourglass

Post by Ange Tuteur October 30th 2015, 12:03 am

Oh no, I meant the post contents of the area you edit.
Edit post > Copy message content
Ange Tuteur
Ange Tuteur
Forumaster

Male Posts : 13246
Reputation : 3000
Language : English & 日本語
Location : Pennsylvania

https://fmdesign.forumotion.com

Back to top Go down

Solved Re: Housepoint Hourglass

Post by Elisabeth McNight October 30th 2015, 5:23 am

Oh! Okay, though I'm not sure there's much to go on:


Professors, Prefects, and Head Boy/Girl are the only ones who may take away or add points to your house.

To add/subtract points, please use this format for each individual house:

Code:
[b]House:[/b]
[b]Points Added:[/b]
[b]Points Subtracted:[/b]

__________________________________________________________________

Housepoint Hourglass Eb4AyDO:

Housepoint Hourglass Fcu7orz:

Housepoint Hourglass 1JgK084:

Housepoint Hourglass STd8Z0k:
Elisabeth McNight
Elisabeth McNight
New Member

Female Posts : 22
Reputation : 2
Language : English

http://hogwartsswwroleplay.forumotion.com/

Back to top Go down

Solved Re: Housepoint Hourglass

Post by Ange Tuteur October 30th 2015, 10:13 am

Thanks !

Just to clarify ; the points go directly after the images, correct ? Smile

I should be able to write something update which you can use to quickly edit the points. I'll let you know when I've finished it. Zen
Ange Tuteur
Ange Tuteur
Forumaster

Male Posts : 13246
Reputation : 3000
Language : English & 日本語
Location : Pennsylvania

https://fmdesign.forumotion.com

Back to top Go down

Solved Re: Housepoint Hourglass

Post by Elisabeth McNight October 30th 2015, 7:18 pm

Yes they do!

Thank you very much, take your time Housepoint Hourglass 1f604
Elisabeth McNight
Elisabeth McNight
New Member

Female Posts : 22
Reputation : 2
Language : English

http://hogwartsswwroleplay.forumotion.com/

Back to top Go down

Solved Re: Housepoint Hourglass

Post by Ange Tuteur October 31st 2015, 12:16 pm

Here, replace the post content with this :
Code:
Professors, Prefects, and Head Boy/Girl are the only ones who may take away or add points to your house.

To add/subtract points, please use this format for each individual house:

[code][b]House:[/b]
[b]Points Added:[/b]
[b]Points Subtracted:[/b][/code]

__________________________________________________________________

[table][tr][td][img]http://i.imgur.com/eb4AyDO.png[/img][/td][td]:[/td][td class="edit_value house1"]100[/td][/tr][tr][td][img]http://i.imgur.com/fcu7orz.png[/img][/td][td]:[/td][td class="edit_value house2"]75[/td][/tr][tr][td][img]http://i.imgur.com/1JgK084.png[/img][/td][td]:[/td][td class="edit_value house3"]50[/td][/tr][tr][td][img]http://i.imgur.com/sTd8Z0k.png[/img][/td][td]:[/td][td class="edit_value house4"]25[/td][/tr][/table]

And then go to Modules > JavaScript codes management and create a new script with the following settings.

Placement : In the topics
Code:
$(function() {
  var a = $('.edit_value'),
      i = 0,
      j = a.length,
      edit, cell, link;

  for (; i < j; i++) {
    edit = $(a[i]).closest('.post').find('.i_icon_edit')[0];
    if (edit) {
      edit = edit.parentNode;

      link = document.createElement('A');
      link.href = edit.href;
      link.innerHTML = 'Edit';
      link.onclick = function() {
        var node = $(this).parent().prev()[0], t = this;
       
        if (node) {
          $.get(t.href, function(data) {
            var auth = $('input[name="auth[]"]', data),
                msg = $('#text_editor_textarea', data).val(),
                pts = prompt('Please insert a new value', msg.match(new RegExp('.*?\\[td class="' + node.className + '"\\](.*?)\\[/td\\].*'))[1] || 0);
            $.post('/post', 'subject=' + $('input[name="subject"]', data).val() + '&message=' + msg.replace(new RegExp('\\[td class="' + node.className + '"\\](.*?)\\[/td\\]'), '[td class="' + node.className + '"]' + pts + '[/td]') + '&mode=editpost&p=' + t.href.replace(/.*?p=(\d+).*/, '$1') + '&auth[]=' + auth[0].value + '&auth[]=' + auth[1].value + '&post=1', function() {
              node.innerHTML = pts;
            });
          });
          return false;
        }
      };

      cell = document.createElement('TD');
      cell.appendChild(link);

      a[i].parentNode.appendChild(cell);
    }
  }
});

After that, it should give you the following result :
Housepoint Hourglass Captur13
Ange Tuteur
Ange Tuteur
Forumaster

Male Posts : 13246
Reputation : 3000
Language : English & 日本語
Location : Pennsylvania

https://fmdesign.forumotion.com

Back to top Go down

Solved Re: Housepoint Hourglass

Post by Elisabeth McNight October 31st 2015, 5:40 pm

Thank you very much Housepoint Hourglass 1f600
Elisabeth McNight
Elisabeth McNight
New Member

Female Posts : 22
Reputation : 2
Language : English

http://hogwartsswwroleplay.forumotion.com/

Back to top Go down

Solved Re: Housepoint Hourglass

Post by SLGray October 31st 2015, 7:49 pm

Topic solved and archived



Housepoint Hourglass Slgray10

When your topic has been solved, ensure you mark the topic solved.
Never post your email in public.
SLGray
SLGray
Administrator
Administrator

Male Posts : 51489
Reputation : 3519
Language : English
Location : United States

https://forumsclub.com/gc/128-link-directory/

Back to top Go down

Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum