Sha256: e7bf8d0acaa21453a6dd95c152eb2edcdb39ac1fb741286b8c90eb2209563c54
Contents?: true
Size: 1.9 KB
Versions: 5
Compression:
Stored size: 1.9 KB
Contents
function $(element) { if (typeof element == "string") { element=document.getElementById(element); } if (element) extend_instance(element,Element); return element; } function extend_instance(instance,hash) { for (var name in hash) { instance[name] = hash[name]; } } var Element = { "hide": function () { this.setStyle("display","none") }, "show": function () { this.setStyle("display","block") }, "visible": function () { return (this.getStyle("display") != "none"); }, "toggle": function () { if (this.visible) { this.hide(); } else { this.show(); } } }; function encodeURIComponent(str) { if (typeof(str) == "string") { return str.replace(/=/g,'%3D').replace(/&/g,'%26'); } //checkboxes and radio buttons return objects instead of a string else if(typeof(str) == "object"){ for (prop in str) { return str[prop].replace(/=/g,'%3D').replace(/&/g,'%26'); } } }; Form.serialize = function(form_element) { return $(form_element).serialize(); }; Ajax.Updater = function (container,url,options) { this.container = container; this.url=url; this.ajax = new Ajax(); this.ajax.requireLogin = 1; if (options["onSuccess"]) { this.ajax.responseType = Ajax.JSON; this.ajax.ondone = options["onSuccess"]; } else { this.ajax.responseType = Ajax.FBML; this.ajax.ondone = function(data) { $(container).setInnerFBML(data); } } if (options["onFailure"]) { this.ajax.onerror = options["onFailure"]; } this.ajax.post(url,options['parameters']); if (options["onLoading"]) { options["onLoading"].call() } }; Ajax.Request = function(url,options) { Ajax.Updater('unused',url,options); }; PeriodicalExecuter = function (callback, frequency) { setTimeout(callback, frequency *1000); setTimeout(function() { new PeriodicalExecuter(callback,frequency); }, frequency*1000); };
Version data entries
5 entries across 5 versions & 3 rubygems