OwlCyberSecurity - MANAGER
Edit File: ai-select.q.min.js
jQuery(document).ready(function(b){function m(a){var c=a.nodeName.toLowerCase();a.hasAttribute("id")&&""!=a.id&&(c=c+"#"+a.id);a.className&&(classes=a.className.replace(/ai-selected|ai-highlighted/g,"").trim())&&(c=c+"."+classes.replace(/\s{2,}/g," ").trim().replace(/ /g,"."));return c}function n(a){for(var c=[];null!=a.parentNode;){for(var b=0,e=0,f=0;f<a.parentNode.childNodes.length;f++){var g=a.parentNode.childNodes[f];g.nodeName==a.nodeName&&(g===a&&(e=b),b++)}a.hasAttribute("id")&&""!=a.id?c.unshift(a.nodeName.toLowerCase()+ "#"+a.id):1<b?c.unshift(a.nodeName.toLowerCase()+":eq("+e+")"):c.unshift(a.nodeName.toLowerCase());a=a.parentNode}return c.slice(1)}function u(a){var b=[],d=!1;a.reverse().forEach(function(a){d||b.unshift(a);d=-1!=a.indexOf("#")});return b}function k(a){a=a.trim();","==a.slice(0,1)&&(a=a.slice(1,a.length));","==a.slice(-1)&&(a=a.slice(0,a.length-1));return a.trim()}function h(a){return'<kbd class="ai-html-element">'+a+"</kbd>"}function p(a){var b=[];a.forEach(function(a){b.push(h(a))});return b}function q(){b(".ai-html-element").click(function(){var a= b(this).text();b("#ai-selector-element").html(h(a));b(".ai-highlighted").removeClass("ai-highlighted");b(".ai-selected").removeClass("ai-selected");b(a).addClass("ai-selected");b("#ai-selector-data "+a).removeClass("ai-selected");b("#ai-selector").val(a)})}function r(a){if(null!=window.opener&&!window.opener.closed){var c=b(window.opener.document).contents(),d=b("#ai-selector").val();a&&(a=c.find(l).val().trim(),a=k(a),""!=a&&(a+=", "),d=a+d);c.find(l).val(d)}}function t(){g?(b("#ai-use-button").hide(), b("#ai-add-button").show()):(b("#ai-use-button").show(),b("#ai-add-button").hide())}var l="AI_POST_INPUT",g=!1,e=null,f=null;document.onclick=function(a){a=a||event;var c;a:{for(c=a.target||a.srcElement;c;){if("a"===(c.nodeName||c.tagName).toLowerCase())break a;c=c.parentNode}c=null}if(c&&(a.preventDefault(),!g)){a={html_element_selection:"AI_POST_HTML_ELEMENT_SELECTION",selector:b("#ai-selector").val(),input:l};var d=document.createElement("form");d.setAttribute("method","post");d.setAttribute("action", c.href);d.setAttribute("target","_self");for(var e in a)a.hasOwnProperty(e)&&(c=document.createElement("input"),c.type="hidden",c.name=e,c.value=encodeURI(a[e]),d.appendChild(c));document.body.appendChild(d);d.submit();document.body.removeChild(d)}};b(document).keydown(function(a){"17"==a.which&&(g=!0,t(),null!=f&&"A"==f.prop("tagName")&&b(f).trigger("mouseover"))});b(document).keyup(function(){g=!1;t();null!=f&&"A"==f.prop("tagName")&&b(f).trigger("mouseout")});b("body").css({"user-select":"none", "margin-top":"140px"});b("body").prepend('<section id="ai-selector-data"><table> <tbody> <tr> <td class="data-name">'+ai_front.element+'</td> <td class="data-value"><section id="ai-selector-element"></section></td> <td><button type="button" id="ai-cancel-button" style="min-width: 110px;" title="'+ai_front.cancel_element_selection+'"> '+ai_front.cancel+" </button></td> </tr> <tr> <td>"+ai_front.path+'</td> <td><section id="ai-selector-path"></section></td> <td><button type="button" id="ai-parent-button" style="min-width: 110px;" title="'+ ai_front.select_parent_element+'"> '+ai_front.parent+" </button></td> </tr> <tr> <td>"+ai_front.selector+'</td> <td style="width: 100%;"><input id="ai-selector" type="text" value="" maxlength="500" title="'+ai_front.css_selector+'" /></td> <td><button type="button" id="ai-use-button" style="min-width: 110px;" title="'+ai_front.use_current_selector+'"> '+ai_front.use+' </button> <button type="button" id="ai-add-button" style="min-width: 110px; display: none;" title="'+ ai_front.add_current_selector+'"> '+ai_front.add+" </button></td> </tr> </tbody></table></section>");b("body").bind("mouseover mouseout click",function(a){var c=b(a.target),d=n(c[0]);if(-1==d.join(" > ").indexOf("ai-selector-data")&&!c.hasClass("ai-html-element"))switch(a.type){case "click":if("A"!=c.prop("tagName")||g)e=c,b("#ai-selector-element").html(h(m(c[0]))),b("#ai-selector-path").html(p(d).join(" > ")),q(),b(".ai-highlighted").removeClass("ai-highlighted"),b(".ai-selected").removeClass("ai-selected"), c.addClass("ai-selected"),b("#ai-selector").val(u(d).join(" > "));break;case "mouseover":f=c;("A"!=c.prop("tagName")||g)&&c.addClass("ai-highlighted");break;case "mouseout":c.removeClass("ai-highlighted")}});b("#ai-selector").on("input",function(){b(".ai-highlighted").removeClass("ai-highlighted");b(".ai-selected").removeClass("ai-selected");var a=k(b("#ai-selector").val());b(a).addClass("ai-selected");var c=a.split(",");c.forEach(function(a){b("#ai-selector-data "+a).removeClass("ai-selected")}); 1==c.length&&1==b(a).length?(e=b(c[0]),b("#ai-selector-element").html(h(m(e[0]))),b("#ai-selector-path").html(p(n(e[0])).join(" > ")),q()):(e=null,b("#ai-selector-element").text(""),b("#ai-selector-path").text(""))});window.onkeydown=function(a){27===a.keyCode&&window.close()};null==window.opener||window.opener.closed||(b("#ai-selector").val(k("AI_POST_SELECTOR")),b("#ai-selector").trigger("input"));b("#ai-cancel-button").button({}).click(function(){window.close()});b("#ai-parent-button").button({}).click(function(){"BODY"!= e.prop("tagName")&&(e=e.parent(),e.click())});b("#ai-use-button").button({}).click(function(){r(!1);window.close()});b("#ai-add-button").button({}).click(function(){r(!0);window.close()})});