PDA

View Full Version : Flip Screen


woodmj
03-30-2014, 05:39 PM
Hi, Would anyone know how I could temporarily turn the screen upside down when someone goes into one of my forums? Just a little something for April 1st I was thinking :-)

ozzy47
03-30-2014, 06:31 PM
Sure, you would need to create a plugin, ACP --> Plugins & Products --> Add New Plugin

Product: vBulletin
Hook Location: parse_templates
Execution Order: 5
Plugin PHP Code: Add the following;
if (date('F j') == 'April 1' AND THIS_SCRIPT == 'forumdisplay' AND in_array($foruminfo['forumid'], array(X,X,X)))
{
$invert = '<style type="text/css">
body {
-webkit-transform: rotate(180deg);
-moz-transform: rotate(180deg);
-ms-transform: rotate(180deg);
-o-transform: rotate(180deg);
transform: rotate(180deg);
}
</style>

<script>
window.onload=toBottom;

function toBottom() {
window.scrollTo(0, document.body.scrollHeight);
}
</script> ';
$template_hook[headinclude_bottom_css] .= $invert;
}

Just change X,X,X to the forums you want this to happen on.

Also note, I wrote this to only happen on April 1, so if you want to test it, change the date.

ozzy47
03-30-2014, 06:53 PM
You would essentially have to re-render the HTML output using JavaScript using 'htmlcanvas' in HTML5. It would require quite a bit of work to implement this.

I have used this library for some fun projects I implemented, which might help you.
http://html2canvas.hertzen.com/

I did like the idea, though. :)

I posted the solution above your post. :p

woodmj
03-31-2014, 08:54 AM
Thanks so much for your help Ozzy.

Unfortuately the plugin doesn't seem to be working on my forum. Maybe I did something wrong?

Please see attached view of the plugin from my ACP.

Many thanks.

ozzy47
03-31-2014, 09:55 AM
Not sure, it should be working, as I have seen it work on 4 sites now. If you want PM me a admin account and I will check it out when I get home from work.

woodmj
03-31-2014, 11:13 AM
Thanks very much, will PM you now.

Not sure, it should be working, as I have seen it work on 4 sites now. If you want PM me a admin account and I will check it out when I get home from work.

ozzy47
03-31-2014, 08:42 PM
If anyone else has trouble getting this to work do the following.

Change the first line of the code:
if (date('F j') == 'April 1' AND THIS_SCRIPT == 'forumdisplay' AND in_array($foruminfo['forumid'], array(X,X,X)))


To this:
if (date('F j') == 'April 1' AND THIS_SCRIPT == 'forumdisplay' AND in_array($GLOBALS['forumid'], array(X,X,X)))

Stefan118
03-31-2014, 11:59 PM
I can not like your post before liking anyone else his post, so i tell it this way:

Me like this very much!

ozzy47
04-01-2014, 12:03 AM
LOL no problem, it happens quite often when people try to like my posts. :)

blind-eddie
04-01-2014, 10:39 AM
I like the ideas, but original code nor edited code would work for me on 3.8.
I did not try it on 4.2
But, thank you for the share ozzy.

ozzy47
04-01-2014, 10:54 AM
I like the ideas, but original code nor edited code would work for me on 3.8.
I did not try it on 4.2
But, thank you for the share ozzy.

Because this is for vB4, the vB3 is a bit different:

Create a plugin, ACP --> Plugins & Products --> Add New Plugin

Product: vBulletin
Hook Location: parse_templates
Execution Order: 5
Plugin PHP Code: Add the following;
if (date('F j') == 'April 1' AND THIS_SCRIPT == 'forumdisplay' AND in_array($foruminfo['forumid'], array(X,X,X)))
{
$invert = '<style type="text/css">
body {
-webkit-transform: rotate(180deg);
-moz-transform: rotate(180deg);
-ms-transform: rotate(180deg);
-o-transform: rotate(180deg);
transform: rotate(180deg);
}
</style>

<script>
window.onload=toBottom;

function toBottom() {
window.scrollTo(0, document.body.scrollHeight);
}
</script> ';
eval($invert);
}

Then open up your headinclude template, and ass this at the very bottom:
$invert

Just change X,X,X to the forums you want this to happen on.

Also note, I wrote this to only happen on April 1, so if you want to test it, change the date.