I like it. Has great potential..
It would be much better if the button's appearance could change with CSS..
Some recommendations:
To avoid conflicts with other plugins that using window.load:
For check if exists the tag [spoiler] and avoid loading code that do not is used in other pages:
It would be much better if the button's appearance could change with CSS..
Some recommendations:
To avoid conflicts with other plugins that using window.load:
Code:
// unobtrusive way for call window.onload
function addEvent(obj, evType, fn){
if (obj.addEventListener){
obj.addEventListener(evType, fn, false);
return true;
} else if (obj.attachEvent){
var r = obj.attachEvent("on"+evType, fn);
return r;
} else {
return false;
}
}
addEvent(window, 'load', yourFunctionLaunchOnWindowLoad);
For check if exists the tag [spoiler] and avoid loading code that do not is used in other pages:
Code:
function check()
{
global $data_index;
if (strpos($data_index->content, '[spoiler]') === false)
{
return false;
}
add_action('theme-header','code');
}