1/////////////////////////////////////////////////// 2// The Qcodo Object is used for everything in Qcodo 3/////////////////////////////////////////////////// 4 5 var qcodo = { 6 initialize: function() { 7 8 //////////////////////////////// 9 // Browser-related functionality 10 //////////////////////////////// 11 12 this.isBrowser = function(intBrowserType) { 13 return (intBrowserType & qcodo._intBrowserType); 14 }; 15 this.IE = 1; 16 this.IE_6_0 = 2; 17 this.IE_7_0 = 4; 18 19 this.FIREFOX = 8; 20 this.FIREFOX_1_0 = 16; 21 this.FIREFOX_1_5 = 32; 22 this.FIREFOX_2_0 = 64; 23 24 this.SAFARI = 128; 25 this.SAFARI_2_0 = 256; 26 this.SAFARI_3_0 = 512; 27 28 this.MACINTOSH = 1024; 29 30 this.UNSUPPORTED = 2048; 31 32 // INTERNET EXPLORER (supporting versions 6.0 and 7.0) 33 if (navigator.userAgent.toLowerCase().indexOf("msie") >= 0) { 34 this._intBrowserType = this.IE; 35 36 if (navigator.userAgent.toLowerCase().indexOf("msie 6.0") >= 0) 37 this._intBrowserType = this._intBrowserType | this.IE_6_0; 38 else if (navigator.userAgent.toLowerCase().indexOf("msie 7.0") >= 0) 39 this._intBrowserType = this._intBrowserType | this.IE_7_0; 40 else 41 this._intBrowserType = this._intBrowserType | this.UNSUPPORTED; 42 43 // FIREFOX (supporting versions 1.0, 1.5 and 2.0) 44 } else if ((navigator.userAgent.toLowerCase().indexOf("firefox") >= 0) || (navigator.userAgent.toLowerCase().indexOf("iceweasel") >= 0)) { 45 this._intBrowserType = this.FIREFOX; 46 var strUserAgent = navigator.userAgent.toLowerCase(); 47 strUserAgent = strUserAgent.replace('iceweasel/', 'firefox/'); 48 49 if (strUserAgent.indexOf("firefox/1.0") >= 0) 50 this._intBrowserType = this._intBrowserType | this.FIREFOX_1_0; 51 else if (strUserAgent.indexOf("firefox/1.5") >= 0) 52 this._intBrowserType = this._intBrowserType | this.FIREFOX_1_5; 53 else if (strUserAgent.indexOf("firefox/2.0") >= 0) 54 this._intBrowserType = this._intBrowserType | this.FIREFOX_2_0; 55 else 56 this._intBrowserType = this._intBrowserType | this.UNSUPPORTED; 57 58 // SAFARI (supporting version 2.0 and eventually 3.0) 59 } else if (navigator.userAgent.toLowerCase().indexOf("safari") >= 0) { 60 this._intBrowserType = this.SAFARI; 61 62 if (navigator.userAgent.toLowerCase().indexOf("safari/41") >= 0) 63 this._intBrowserType = this._intBrowserType | this.SAFARI_2_0; 64 else if (navigator.userAgent.toLowerCase().indexOf("safari/52") >= 0) 65 this._intBrowserType = this._intBrowserType | this.SAFARI_3_0; 66 else 67 this._intBrowserType = this._intBrowserType | this.UNSUPPORTED; 68 69 // COMPLETELY UNSUPPORTED 70 } else 71 this._intBrowserType = this.UNSUPPORTED; 72 73 // MACINTOSH? 74 if (navigator.userAgent.toLowerCase().indexOf("macintosh") >= 0) 75 this._intBrowserType = this._intBrowserType | this.MACINTOSH; 76 77 78 79 //////////////////////////////// 80 // Browser-related functionality 81 //////////////////////////////// 82 83 this.loadJavaScriptFile = function(strScript, objCallback) { 84 strScript = qc.jsAssets + "/" + strScript; 85 var objNewScriptInclude = document.createElement("script"); 86 objNewScriptInclude.setAttribute("type", "text/javascript"); 87 objNewScriptInclude.setAttribute("src", strScript); 88 document.getElementById(document.getElementById("Qform__FormId").value).appendChild(objNewScriptInclude); 89 90 // IE does things differently... 91 if (qc.isBrowser(qcodo.IE)) { 92 objNewScriptInclude.callOnLoad = objCallback; 93 objNewScriptInclude.onreadystatechange = function() { 94 if ((this.readyState == "complete") || (this.readyState == "loaded")) 95 if (this.callOnLoad) 96 this.callOnLoad(); 97 }; 98 99 // ... than everyone else 100 } else { 101 objNewScriptInclude.onload = objCallback; 102 }; 103 }; 104 105 this.loadStyleSheetFile = function(strStyleSheetFile, strMediaType) { 106 // IE does things differently... 107 if (qc.isBrowser(qcodo.IE)) { 108 var objNewScriptInclude = document.createStyleSheet(strStyleSheetFile); 109 110 // ...than everyone else 111 } else { 112 var objNewScriptInclude = document.createElement("style"); 113 objNewScriptInclude.setAttribute("type", "text/css"); 114 objNewScriptInclude.setAttribute("media", strMediaType); 115 objNewScriptInclude.innerHTML = '@import "' + strStyleSheetFile + '";'; 116 document.body.appendChild(objNewScriptInclude); 117 }; 118 }; 119 120 121 122 ///////////////////////////// 123 // QForm-related functionality 124 ///////////////////////////// 125 126 this.registerForm = function() { 127 // "Lookup" the QForm's FormId 128 var strFormId = document.getElementById("Qform__FormId").value; 129 130 // Register the Various Hidden Form Elements needed for QForms 131 this.registerFormHiddenElement("Qform__FormControl", strFormId); 132 this.registerFormHiddenElement("Qform__FormEvent", strFormId); 133 this.registerFormHiddenElement("Qform__FormParameter", strFormId); 134 this.registerFormHiddenElement("Qform__FormCallType", strFormId); 135 this.registerFormHiddenElement("Qform__FormUpdates", strFormId); 136 this.registerFormHiddenElement("Qform__FormCheckableControls", strFormId); 137 }; 138 139 this.registerFormHiddenElement = function(strId, strFormId) { 140 var objHiddenElement = document.createElement("input"); 141 objHiddenElement.type = "hidden"; 142 objHiddenElement.id = strId; 143 objHiddenElement.name = strId; 144 document.getElementById(strFormId).appendChild(objHiddenElement); 145 }; 146 147 this.wrappers = new Array(); 148 149 150 151 //////////////////////////////////// 152 // Mouse Drag Handling Functionality 153 //////////////////////////////////// 154 155 this.enableMouseDrag = function() { 156 document.onmousedown = qcodo.handleMouseDown; 157 document.onmousemove = qcodo.handleMouseMove; 158 document.onmouseup = qcodo.handleMouseUp; 159 }; 160 161 this.handleMouseDown = function(objEvent) { 162 objEvent = qcodo.handleEvent(objEvent); 163 164 var objHandle = qcodo.target; 165 if (!objHandle) return true; 166 167 var objWrapper = objHandle.wrapper; 168 if (!objWrapper) return true; 169 170 // Qcodo-Wide Mouse Handling Functions only operate on the Left Mouse Button 171 // (Control-specific events can respond to QRightMouse-based Events) 172 if (qcodo.mouse.left) { 173 if (objWrapper.handleMouseDown) { 174 // Specifically for Microsoft IE 175 if (objHandle.setCapture) 176 objHandle.setCapture(); 177 178 // Ensure the Cleanliness of Dragging 179 objHandle.onmouseout = null; 180 if (document.selection) 181 document.selection.empty(); 182 183 qcodo.currentMouseHandleControl = objWrapper; 184 return objWrapper.handleMouseDown(objEvent, objHandle); 185 }; 186 }; 187
188 qcodo.currentMouseHandleControl = null; 189 return true; 190 }; 191 192 this.handleMouseMove = function(objEvent) { 193 objEvent = qcodo.handleEvent(objEvent); 194 195 if (qcodo.currentMouseHandleControl) { 196 var objWrapper = qcodo.currentMouseHandleControl; 197 var objHandle = objWrapper.handle; 198 199 // In case IE accidentally marks a selection... 200 if (document.selection) 201 document.selection.empty(); 202 203 if (objWrapper.handleMouseMove) 204 return objWrapper.handleMouseMove(objEvent, objHandle); 205 }; 206 207 return true; 208 }; 209 210 this.handleMouseUp = function(objEvent) { 211 objEvent = qcodo.handleEvent(objEvent); 212 213 if (qcodo.currentMouseHandleControl) { 214 var objWrapper = qcodo.currentMouseHandleControl; 215 var objHandle = objWrapper.handle; 216 217 // In case IE accidentally marks a selection... 218 if (document.selection) 219 document.selection.empty(); 220 221 // For IE to release release/setCapture 222 if (objHandle.releaseCapture) { 223 objHandle.releaseCapture(); 224 objHandle.onmouseout = function() {this.releaseCapture()}; 225 }; 226 227 qcodo.currentMouseHandleControl = null; 228 229 if (objWrapper.handleMouseUp) 230 return objWrapper.handleMouseUp(objEvent, objHandle); 231 }; 232 233 return true; 234 }; 235 236 237 238 //////////////////////////////////// 239 // Window Unloading 240 //////////////////////////////////// 241 242 this.unloadFlag = false; 243 this.handleBeforeUnload = function() { 244 qcodo.unloadFlag = true; 245 }; 246 window.onbeforeunload = this.handleBeforeUnload; 247 248 249 250 //////////////////////////////////// 251 // Color Handling Functionality 252 //////////////////////////////////// 253 254 this.colorRgbValues = function(strColor) { 255 strColor = strColor.replace("#", ""); 256 257 try { 258 if (strColor.length == 3) 259 return new Array( 260 eval("0x" + strColor.substring(0, 1)), 261 eval("0x" + strColor.substring(1, 2)), 262 eval("0x" + strColor.substring(2, 3)) 263 ); 264 else if (strColor.length == 6) 265 return new Array( 266 eval("0x" + strColor.substring(0, 2)), 267 eval("0x" + strColor.substring(2, 4)), 268 eval("0x" + strColor.substring(4, 6)) 269 ); 270 } catch (Exception) {}; 271 272 return new Array(0, 0, 0); 273 }; 274 275 this.hexFromInt = function(intNumber) { 276 intNumber = (intNumber > 255) ? 255 : ((intNumber < 0) ? 0 : intNumber); 277 intFirst = Math.floor(intNumber / 16); 278 intSecond = intNumber % 16; 279 return intFirst.toString(16) + intSecond.toString(16); 280 }; 281 282 this.colorRgbString = function(intRgbArray) { 283 return "#" + qcodo.hexFromInt(intRgbArray[0]) + qcodo.hexFromInt(intRgbArray[1]) + qcodo.hexFromInt(intRgbArray[2]); 284 }; 285 } 286 }; 287 288 289 290//////////////////////////////// 291// Qcodo Shortcut and Initialize 292//////////////////////////////// 293 294 var qc = qcodo; 295 qc.initialize();
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.