Object.freeze((function () { String.prototype.isInt = function () { return !isNaN(parseInt(this, 10)); }; String.prototype.isLower = function () { return this == this.toLowerCase(); }; var globals = { active : null, matchHint : -1, escapeChar : "\\", activeArr : [], activeInput : null, elements : [], positions : [], lastInput : null, lastPosition : 0, newTab : false, notify : null, hintTypes : [ "a, textarea, select, input:not([type=hidden]), button, frame, iframe, [onclick], [onmousedown]," + "[role=link], [role=option], [role=button], [role=option], img", // HINT_T_ALL //[ "iframe", "a", // HINT_T_LINKS "img", // HINT_T_IMAGES "input:not([type=hidden]), input[type=text], input[type=password], input[type=search], textarea", // HINT_T_EDITABLE "[src], [href]" // HINT_T_URL ] }; var HintTypes = { HINT_T_ALL : 0, HINT_T_LINKS : 1, HINT_T_IMAGES : 2, HINT_T_EDITABLE : 3, HINT_T_URL : 4 }; var OpenMode = { OPEN_NORMAL : 1<<0, OPEN_NEW_VIEW : 1<<1, OPEN_NEW_WINDOW : 1<<2 }; var p_getTextHints = function(arr) { var length = arr.length; var i, j, e, text, cur, start, l, max, r; if (length === 0) return; if (arr[0] instanceof p_numberHint) { for (i=0; i 0 ? width : width + compleft) + "px"; overlay.style.height = (comptop > 0 ? height : height + comptop) + "px"; overlay.style.top = t + "px"; overlay.style.left = l + "px"; overlay.style.display = "block"; overlay.style.cursor = "pointer"; overlay.style.zIndex = 37001; this.overlay = overlay; }; this.hint = hint; }; var p_createElement = function(tagname) { var element = document.createElement(tagname); if (!element.style) { var namespace = document.getElementsByTagName('html')[0].getAttribute('xmlns') || "http://www.w3.org/1999/xhtml"; element = document.createElementNS(namespace, tagname); } return element; }; var p_numberHint = function (element, win, rect, offsetElement) { this.varructor = p_newHint; this.varructor(element, win, rect, offsetElement); this.getStart = function(n) { var start = parseInt(Math.log(n) / Math.log(10), 10)*10; if (n > 10*start-start) start*=10; return Math.max(start, 1); }; this.betterMatch = function(input) { var length = globals.activeArr.length; var i, cl; if (input.isInt()) return 0; var bestposition = 37; var ret = 0; for (i=0; i input.length)) { p_clear(); globals.lastInput = input; p_showHints(type, globals.newTab); return p_updateHints(input, type); } globals.lastInput = input; if (input) { if (input[input.length-1] == globals.escapeChar && globals.matchHint == -1) { globals.matchHint = input.indexOf(globals.escapeChar) + 1; return null; } if (globals.matchHint != -1) { input = input.substring(globals.matchHint); } else if (globals.style == "number") { if (input[input.length-1].isInt()) { input = input.match(/[0-9]+/g).join(""); matchHint = true; } else input = input.match(/[^0-9]+/g).join(""); } else if (globals.style == "letter") { var lowerSeq = globals.letterSeq.toLowerCase(); if (input[input.length-1].isLower()) { if (lowerSeq.indexOf(input.charAt(input.length-1)) == -1) return "_dwb_no_hints_"; input = input.match(new RegExp("[" + lowerSeq + "]", "g")).join(""); matchHint = true; } else input = input.match(new RegExp("[^" + lowerSeq + "]", "g")).join(""); } } for (i=0; i height || r.bottom < 0 || r.left > width || r.right < 0 || !e.getClientRects()[0]) return null; return r; }; var p_clear = function() { var p, i; try { if (globals.elements) { for (i=0; i