Continuation of the spooky ghost counter topic
2 posters
Page 1 of 1
Continuation of the spooky ghost counter topic
I have been following the spooky ghost topic and find it very interesting. Ange Tuteur mentioned at some point that he has an idea with a profile field. If I'm correct it never get mentioned, but I'm still interested to know anyway.
URL: https://help.forumotion.com/t136605-spooky-ghost-counter-and-rank#921735
Thank you!
Yaya
URL: https://help.forumotion.com/t136605-spooky-ghost-counter-and-rank#921735
Thank you!
Yaya
yayayes- Forumember
- Posts : 49
Reputation : 1
Language : Thai
Location : Bangkok, London & Hong Kong
Re: Continuation of the spooky ghost counter topic
Hello yayayes,
Try this :
Go to Administration Panel > Users and groups > Profiles > Create new profile field
Make sure it has the following content :
Check after creating to make sure the default is 0, save, and then replace the content for everyone.
Next, create a new script :
Modules > JavaScript codes management > Create a new script
Title : get field data
Placement : In all the pages
Paste the code below and submit :
This is a tool to help you get the profile data of that field. Go to your user profile and click your new profile field, it should alert you with some data that you should copy to a textpad.
Once you have that data copied somewhere you can remove that script.
Now, create a new script for the ghosts :
Title : Your choice
Placement : Your choice
Modifications :
Chance : This is the chance for the ghost to appear. Lower = higher chance, higher = lower chance.
id : remember that id you copied before ? Well, replace field_id with that id. for example my id was field_id2, so that's what I'll write.
name : You guessed it the last data you copied. Replace profile_field with that name. Mine was profile_field_13_2, so that's what I'll write.
When finished, save, and you should be good.
Oh, for some extra protection, so the members can't edit the field use this CSS :
Display > Colors > CSS
Try this :
Go to Administration Panel > Users and groups > Profiles > Create new profile field
Make sure it has the following content :
Check after creating to make sure the default is 0, save, and then replace the content for everyone.
Next, create a new script :
Modules > JavaScript codes management > Create a new script
Title : get field data
Placement : In all the pages
Paste the code below and submit :
- Code:
/\/u\d+/.test(window.location.pathname) && $(function() {
$('[id^="field_id"]').on('click',function() {
alert('Copy the following to a textpad.\n\n id : '+ $(this).attr('id') + '\n name : '+ $(this).find('[name^="profile"]').attr('name'));
});
});
This is a tool to help you get the profile data of that field. Go to your user profile and click your new profile field, it should alert you with some data that you should copy to a textpad.
Once you have that data copied somewhere you can remove that script.
Now, create a new script for the ghosts :
Title : Your choice
Placement : Your choice
- Code:
$(function() {
var chance = 10, id = 'field_id', name = 'profile_field', content = new Array();
if (_userdata.user_id === -1) return; // excludes guests
if (/\/profile/.test(window.location.pathname)) $(function(){$('dl:has(#'+name+')').remove()});
// Happy Halloween from Forumotion !
var ghost = document.createElement('IMG'), actif = false;
ghost.src = 'http://i39.servimg.com/u/f39/18/21/60/73/ghost10.png';
ghost.setAttribute('style','position:fixed;top:0%;left:0%;z-index:99999;display:none;');
document.body.appendChild(ghost);
ghost.onclick = function() {
var storage = window.localStorage;
ghost.style.display = 'none';
if (storage.ghostClicks) {
storage.ghostClicks = Number(storage.ghostClicks) + 1;
content.push(new Array(name, storage.ghostClicks));
$.post('/ajax_profile.forum?jsoncallback=?', {
id : id.substring(8, id.length),
user : _userdata.user_id,
active : '1',
content : $.toJSON(content),
tid : document.getElementById('logout').href.replace(/.*tid=(.*?)&.*/,'$1')
},function(data){}, 'json');
}
else if (storage) {
$('body').append('<div id="contU" style="display:none"></div>');
$('#contU').load('/u'+_userdata.user_id+' #' + id + ' .field_uneditable', function() {storage.ghostClicks = Number($(this).text()) + 1});
}
};
window.setInterval('_spook_ghost()', 1000);
_spook_ghost = function() {
if (random(chance) === 0 && actif === false) {
actif = true;
ghost.style.left = random(76) + '%';
ghost.style.top = random(76) + '%';
ghost.style.width = '48px';
ghost.style.opacity = '1';
ghost.style.display = '';
_animation_ghost = window.setInterval(function() {
if (Number(ghost.style.opacity) <= 0) {
ghost.style.display = 'none';
window.clearInterval(_animation_ghost);
return actif = false;
}
ghost.style.width = Number(ghost.style.width.replace(/px/,'')) + 10 + 'px';
ghost.style.opacity = Number(ghost.style.opacity) - 0.01;
},1);
}
};
function random(val) { return Math.floor(Math.random() * val) };
});
Modifications :
Chance : This is the chance for the ghost to appear. Lower = higher chance, higher = lower chance.
id : remember that id you copied before ? Well, replace field_id with that id. for example my id was field_id2, so that's what I'll write.
name : You guessed it the last data you copied. Replace profile_field with that name. Mine was profile_field_13_2, so that's what I'll write.
When finished, save, and you should be good.
Oh, for some extra protection, so the members can't edit the field use this CSS :
Display > Colors > CSS
- Code:
#field_id2 .field_editable, #field_id2 .ajax-profil_edit, #field_id2 .ajax-profil_valid { display:none !important }
Re: Continuation of the spooky ghost counter topic
It's all clear! Thank you again Ange Tuteur
yayayes- Forumember
- Posts : 49
Reputation : 1
Language : Thai
Location : Bangkok, London & Hong Kong
Re: Continuation of the spooky ghost counter topic
You're welcome ^^
Topic archived
If you have any problems do not hesitate to open a new topic.
Topic archived
If you have any problems do not hesitate to open a new topic.
Similar topics
» Forum Topic Counter
» spooky ranks
» Javascript counter add more
» Continuation of NFS Rank Banners
» Ghost chatbox users?
» spooky ranks
» Javascript counter add more
» Continuation of NFS Rank Banners
» Ghost chatbox users?
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum