The forum of the forums
Welcome to the Official Support Forum of Forumotion!

To take full advantage of everything offered by our forum, please log in if you are already a member, or join our community if you've not yet.



Create a free forum like this one.

Housepoint Hourglass

View previous topic View next topic Go down

Solved Housepoint Hourglass

Post by Elisabeth McNight on 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
avatar
Elisabeth McNight
New Member

Female Posts : 22
Reputation : 1
Language : English

http://hogwartsswwroleplay.forumotion.com/

Back to top Go down

Solved Re: Housepoint Hourglass

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

Bump
avatar
Elisabeth McNight
New Member

Female Posts : 22
Reputation : 1
Language : English

http://hogwartsswwroleplay.forumotion.com/

Back to top Go down

Solved Re: Housepoint Hourglass

Post by Ange Tuteur on 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.. )
avatar
Ange Tuteur
Forumaster

Male Posts : 13172
Reputation : 2868
Language : EN10, FR5
Location : Macungie, PA

http://fmdesign.forumotion.com

Back to top Go down

Solved Re: Housepoint Hourglass

Post by Elisabeth McNight on 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.
avatar
Elisabeth McNight
New Member

Female Posts : 22
Reputation : 1
Language : English

http://hogwartsswwroleplay.forumotion.com/

Back to top Go down

Solved Re: Housepoint Hourglass

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

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

Male Posts : 13172
Reputation : 2868
Language : EN10, FR5
Location : Macungie, PA

http://fmdesign.forumotion.com

Back to top Go down

Solved Re: Housepoint Hourglass

Post by Elisabeth McNight on 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]

__________________________________________________________________

:

:

:

:
avatar
Elisabeth McNight
New Member

Female Posts : 22
Reputation : 1
Language : English

http://hogwartsswwroleplay.forumotion.com/

Back to top Go down

Solved Re: Housepoint Hourglass

Post by Ange Tuteur on 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
avatar
Ange Tuteur
Forumaster

Male Posts : 13172
Reputation : 2868
Language : EN10, FR5
Location : Macungie, PA

http://fmdesign.forumotion.com

Back to top Go down

Solved Re: Housepoint Hourglass

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

Yes they do!

Thank you very much, take your time
avatar
Elisabeth McNight
New Member

Female Posts : 22
Reputation : 1
Language : English

http://hogwartsswwroleplay.forumotion.com/

Back to top Go down

Solved Re: Housepoint Hourglass

Post by Ange Tuteur on 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 :
avatar
Ange Tuteur
Forumaster

Male Posts : 13172
Reputation : 2868
Language : EN10, FR5
Location : Macungie, PA

http://fmdesign.forumotion.com

Back to top Go down

Solved Re: Housepoint Hourglass

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

Thank you very much
avatar
Elisabeth McNight
New Member

Female Posts : 22
Reputation : 1
Language : English

http://hogwartsswwroleplay.forumotion.com/

Back to top Go down

Solved Re: Housepoint Hourglass

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

Topic solved and archived



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

avatar
SLGray
Administrator
Administrator

Male Posts : 39122
Reputation : 2625
Language : English
Location : United States

https://fmthemes.forumotion.com/

Back to top Go down

View previous topic View next topic Back to top


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