Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Options

An event on a page at random

edited April 2008 in Vanilla 1.0 Help
Hi,,, suppose you have a site, and you want to have something happen at a random moment in time... i'd have it like the entire site flips upside down for half a second, but it could be anything from a "hi" alert to a redirect to a different page... but i need a now-and-then trigger of something like a flip...
the question:

how do i run a script at a random moment in time (with a probability, of course)?

so, for example, during the session, on the 69 second the screen flips upside down for half a second... then on 320th second the screen goes black for half a second etc...

thanks

Comments

  • Options
    lol what is this for?
  • Options
    A late April Fools Day joke?
  • Options
    There probably are a number of ways of actually implementing this, but I suspect you would have to use some sort of javascript function that (1) keeps time and (2) either activates the effects itself, or calls other functions to activate the effects. If you wanted to be fancy, you could also throw in some sort of AJAX feature were the javascript checks the server and/or database for instructions on what to do.
  • Options
    timefire, you are right.. this is exactly what i want, i mean javascript-based time checker which triggers other javascript scripts.... but i don't know how to start... if you could tell me the general algorithm, id be grateful... and there actually certain applicable sense in this, ... its not a joke.... stay for a relatively long time for example at http://conclave.ru and you will udnerstand what i mean
  • Options
    the only things you need to do are saving seconds and pure javascript together with a key in a 3-column table defining one action, write an additional javascript for the forum that invokes a frequent (eg. every 10 seconds) ajax-request with two parameters containing the elapsed time and the actions that were already executed (maybe separated by minus) to a script that queries the table described above for not yet executed actions in the elapsed-timeframe and outputs the pure action (base64-encoded) javascript code that can be (base64-decoded and) eval'd by the requesting script.
    with a second table or more columns in that one table you can also make the actions user/group-specific.
This discussion has been closed.