Housepoint Hourglass
3 posters
Page 1 of 1
Housepoint Hourglass
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?
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
Re: Housepoint Hourglass
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.. )
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.. )
Re: Housepoint Hourglass
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.
Re: Housepoint Hourglass
Oh no, I meant the post contents of the area you edit.
Edit post > Copy message content
Edit post > Copy message content
Re: Housepoint Hourglass
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]
__________________________________________________________________
:
:
:
:
Re: Housepoint Hourglass
Thanks !
Just to clarify ; the points go directly after the images, correct ?
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.
Just to clarify ; the points go directly after the images, correct ?
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.
Re: Housepoint Hourglass
Here, replace the post content with this :
And then go to Modules > JavaScript codes management and create a new script with the following settings.
Placement : In the topics
After that, it should give you the following result :
- 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 :
Re: Housepoint Hourglass
Topic solved and archived
Lost Founder's Password |Forum's Utilities |Report a Forum |General Rules |FAQ |Tricks & Tips
You need one post to send a PM.
You need one post to send a PM.
When your topic has been solved, ensure you mark the topic solved.
Never post your email in public.
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum