⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rating.js

📁 在Symbian 3版中获取设备IMEI码.
💻 JS
字号:
/*Page:           rating.jsCreated:        Aug 2006Last Mod:       Mar 11 2007Handles actions and requests for rating bars.	--------------------------------------------------------- ryan masuga, masugadesign.comryan@masugadesign.com Licensed under a Creative Commons Attribution 3.0 License.http://creativecommons.org/licenses/by/3.0/See readme.txt for full credit details.--------------------------------------------------------- */var xmlhttp/*@cc_on @*//*@if (@_jscript_version >= 5)try {    xmlhttp=new ActiveXObject("Msxml2.XMLHTTP")} catch (e) {    try {        xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")    } catch (E) {        xmlhttp=false    }}@elsexmlhttp=false@end @*/if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {    try {        xmlhttp = new XMLHttpRequest();    } catch (e) {        xmlhttp = false    }}function myXMLHttpRequest() {    var xmlhttplocal;    try {        xmlhttplocal = new ActiveXObject("Msxml2.XMLHTTP")    } catch (e) {        try {            xmlhttplocal = new ActiveXObject("Microsoft.XMLHTTP")        } catch (E) {            xmlhttplocal = false;        }    }    if (!xmlhttplocal && typeof XMLHttpRequest != 'undefined') {        try {            var xmlhttplocal = new XMLHttpRequest();        } catch (e) {            var xmlhttplocal = false;            // DEBUG: alert('couldn\'t create xmlhttp object');        }    }    return(xmlhttplocal);}function sndReq(vote, id_num, type, units) {    var theUL = document.getElementById('unit_ul' + type + id_num); // the UL    // DEBUG: alert("theUL id: " + 'unit_ul' + type + id_num); alert("theUL: " + theUL);    // switch UL with a loading div    theUL.innerHTML = '<div class="loading"></div>';    var voteUrl = 'http://wiki.forum.nokia.com/rpc.php?j=' + vote + '&q=' + id_num + '&t=' + type + '&c=' + units;    // DEBUG: alert("voteUrl: " + voteUrl);    xmlhttp.open('get', voteUrl);    xmlhttp.onreadystatechange = handleResponse;    xmlhttp.send(null);	}function handleResponse() {    if(xmlhttp.readyState == 4) {        if (xmlhttp.status == 200) {            var response = xmlhttp.responseText;            // DEBUG: alert("Response: " + response);            var update = new Array();            if(response.indexOf('|') != -1) {                update = response.split('|');                ratingChangeText(update[0], update[1]);            }        }    }}function ratingChangeText(div2showraw, text) {    // Detect Browser    var div2show = trim(div2showraw);        // DEBUG: alert(div2show);    var IE = (document.all) ? 1 : 0;    var DOM = 0;    if (parseInt(navigator.appVersion) >= 5) {        DOM = 1;    }    // Grab the content from the requested "div" and show it in the "container"    if (DOM) {        var viewer = document.getElementById(div2show);        viewer.innerHTML = text;    }  else if(IE) {        document.all[div2show].innerHTML = text;    }}function trim (str) {    str = this != window? this : str;    return str.replace(/^\s+/g, '').replace(/\s+$/g, '').replace(/[^0-9a-zA-Z]/g, '');    }/* =============================================================== */var ratingAction = {    'a.rater' : function(element){        element.onclick = function(){            // DEBUG: alert("HREF: " + this.href);            var parameterString = this.href.replace(/.*\?(.*)/, "$1"); // onclick="sndReq('j=1&q=2&t=127.0.0.1&c=5');            var parameterTokens = parameterString.split("&"); // onclick="sndReq('j=1,q=2,t=127.0.0.1,c=5');            var parameterList = new Array();            for (j = 0; j < parameterTokens.length; j++) {                var parameterName = trim(parameterTokens[j].replace(/(.*)=.*/, "$1")); // j                var parameterValue = trim(parameterTokens[j].replace(/.*=(.*)/, "$1")); // 1                parameterList[parameterName] = parameterValue;            }            var theratingID = parameterList['q'];            var theVote = parameterList['j'];            var theuserIP = parameterList['t'];            var theunits = parameterList['c'];            theunits = theunits.substr(0, theunits.length -2);            // DEBUG: alert("theunits: ]" + theunits + "["); alert('sndReq(' + theVote + ',' + theratingID + ',' + theuserIP + ',' + theunits + ')');            sndReq(theVote, theratingID, theuserIP, theunits);             return false;		        }    }};Behaviour.register(ratingAction);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -