diff -r 902822492a68 -r fe660c52c48f includes/clientside/static/misc.js~
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/includes/clientside/static/misc.js~ Wed Jun 13 16:07:17 2007 -0400
@@ -0,0 +1,563 @@
+// Some additional DHTML functions
+
+function fetch_offset(obj) {
+ var left_offset = obj.offsetLeft;
+ var top_offset = obj.offsetTop;
+ while ((obj = obj.offsetParent) != null) {
+ left_offset += obj.offsetLeft;
+ top_offset += obj.offsetTop;
+ }
+ return { 'left' : left_offset, 'top' : top_offset };
+}
+
+function fetch_dimensions(o) {
+ var w = o.offsetWidth;
+ var h = o.offsetHeight;
+ return { 'w' : w, 'h' : h };
+}
+
+function findParentForm(o)
+{
+ // Not implemented - someone please let me know how to do this, what I need to do is
+ // find the first parent
';
+ ajax_auth_mb_cache.updateContent(form_html);
+ $('messageBox').object.nextSibling.firstChild.tabindex = '3';
+ $('ajaxlogin_user').object.focus();
+ $('ajaxlogin_pass').object.onblur = function() { $('messageBox').object.nextSibling.firstChild.focus(); };
+ }
+ });
+}
+
+function ajaxValidateLogin()
+{
+ var username,password,auth_enabled,crypt_key,crypt_data,challenge_salt,challenge_data;
+ username = document.getElementById('ajaxlogin_user');
+ if ( !username )
+ return false;
+ username = document.getElementById('ajaxlogin_user').value;
+ password = document.getElementById('ajaxlogin_pass').value;
+ auth_enabled = false;
+
+ disableJSONExts();
+
+ //
+ // Encryption test
+ //
+
+ var str = '';
+ for(i=0;i \
+ ';
+
+ ajax_auth_mb_cache.updateContent(loading_win);
+
+ ajaxPost(makeUrlNS('Special', 'Login', 'act=ajaxlogin'), 'params=' + json_data, function() {
+ if ( ajax.readyState == 4 )
+ {
+ var response = ajax.responseText;
+ if ( response.substr(0,1) != '{' )
+ {
+ alert('Invalid JSON response from server: ' + response);
+ ajaxAuthLoginInnerSetup();
+ return false;
+ }
+ response = parseJSON(response);
+ switch(response.result)
+ {
+ case 'success':
+ if ( typeof(ajax_auth_prompt_cache) == 'function' )
+ {
+ ajax_auth_prompt_cache(response.key);
+ }
+ break;
+ case 'error':
+ alert(response.error);
+ ajaxAuthLoginInnerSetup();
+ break;
+ default:
+ alert(ajax.responseText);
+ break;
+ }
+ }
+ });
+
+ return true;
+
+}
+
+// This code is in the public domain. Feel free to link back to http://jan.moesen.nu/
+function sprintf()
+{
+ if (!arguments || arguments.length < 1 || !RegExp)
+ {
+ return;
+ }
+ var str = arguments[0];
+ var re = /([^%]*)%('.|0|\x20)?(-)?(\d+)?(\.\d+)?(%|b|c|d|u|f|o|s|x|X)(.*)/;
+ var a = b = [], numSubstitutions = 0, numMatches = 0;
+ while (a = re.exec(str))
+ {
+ var leftpart = a[1], pPad = a[2], pJustify = a[3], pMinLength = a[4];
+ var pPrecision = a[5], pType = a[6], rightPart = a[7];
+
+ //alert(a + '\n' + [a[0], leftpart, pPad, pJustify, pMinLength, pPrecision);
+
+ numMatches++;
+ if (pType == '%')
+ {
+ subst = '%';
+ }
+ else
+ {
+ numSubstitutions++;
+ if (numSubstitutions >= arguments.length)
+ {
+ alert('Error! Not enough function arguments (' + (arguments.length - 1) + ', excluding the string)\nfor the number of substitution parameters in string (' + numSubstitutions + ' so far).');
+ }
+ var param = arguments[numSubstitutions];
+ var pad = '';
+ if (pPad && pPad.substr(0,1) == "'") pad = leftpart.substr(1,1);
+ else if (pPad) pad = pPad;
+ var justifyRight = true;
+ if (pJustify && pJustify === "-") justifyRight = false;
+ var minLength = -1;
+ if (pMinLength) minLength = parseInt(pMinLength);
+ var precision = -1;
+ if (pPrecision && pType == 'f') precision = parseInt(pPrecision.substring(1));
+ var subst = param;
+ if (pType == 'b') subst = parseInt(param).toString(2);
+ else if (pType == 'c') subst = String.fromCharCode(parseInt(param));
+ else if (pType == 'd') subst = parseInt(param) ? parseInt(param) : 0;
+ else if (pType == 'u') subst = Math.abs(param);
+ else if (pType == 'f') subst = (precision > -1) ? Math.round(parseFloat(param) * Math.pow(10, precision)) / Math.pow(10, precision): parseFloat(param);
+ else if (pType == 'o') subst = parseInt(param).toString(8);
+ else if (pType == 's') subst = param;
+ else if (pType == 'x') subst = ('' + parseInt(param).toString(16)).toLowerCase();
+ else if (pType == 'X') subst = ('' + parseInt(param).toString(16)).toUpperCase();
+ }
+ str = leftpart + subst + rightPart;
+ }
+ return str;
+}
+
+function paginator_goto(parentobj, this_page, num_pages, perpage, url_string)
+{
+ var height = $(parentobj).Height();
+ var width = $(parentobj).Width();
+ var left = $(parentobj).Left();
+ var top = $(parentobj).Top();
+ var left_pos = left + width ;
+ var top_pos = height + top;
+ var div = document.createElement('div');
+ div.style.position = 'absolute';
+ div.style.top = top_pos + 'px';
+ div.className = 'question-box';
+ div.style.margin = '1px 0 0 2px';
+ var vtmp = 'input_' + Math.floor(Math.random() * 1000000);
+ div.innerHTML = 'Go to page:
» ×';
+
+ var body = document.getElementsByTagName('body')[0];
+ body.appendChild(div);
+
+ document.getElementById(vtmp).onkeypress = function(e){if(e.keyCode==13)this.nextSibling.nextSibling.onclick();};
+ document.getElementById(vtmp).focus();
+
+ // fade the div
+ /*
+ if(!div.id) div.id = 'autofade_'+Math.floor(Math.random() * 100000);
+ var from = '#33FF33';
+ Fat.fade_element(div.id,30,2000,from,Fat.get_bgcolor(div.id));
+ */
+ fly_in_bottom(div, false, true);
+
+ var divh = $(div).Width();
+ left_pos = left_pos - divh;
+ div.style.left = left_pos + 'px';
+}
+
+function paginator_submit(obj, max, perpage, formatstring)
+{
+ var userinput = obj.previousSibling.previousSibling.value;
+ userinput = parseInt(userinput);
+ var offset = ( userinput - 1 ) * perpage;
+ if ( userinput > max || isNaN(userinput) || userinput < 1 )
+ {
+ new messagebox(MB_OK|MB_ICONSTOP, 'Invalid entry', 'Please enter a page number between 1 and ' + max + '.');
+ return false;
+ }
+ var url = sprintf(formatstring, String(offset));
+ fly_out_top(obj.parentNode, false, true);
+ window.location = url;
+}
+