+ teramako
+ MPL 1.1
+
+
+ For test XPath.
+
+ CAUTION: This plugin needs "DOM Inspector" addon.
+ -
+ :xpathb :xpathblink
+ :xpathblink expression
+
+
+ blink specified elements with XPath expression
+
+
+
+;
(function(){
-const Cc = Components.classes;
-const Ci = Components.interfaces;
-var flasher = null;
+let extid = "inspector@mozilla.org";
+if (!Application.extensions.has(extid) || !Application.exntensions.get(extid).enabled){
+ liberator.ecomsg("DOM Inspector is not installed or enabled", 2);
+ return;
+}
+let flasher = null;
function getFlasher(){
if (!flasher){
flasher = Cc['@mozilla.org/inspector/flasher;1'].createInstance(Ci.inIFlasher);
@@ -39,23 +41,23 @@ function getFlasher(){
*/
function blink(aNode){
if (aNode.nodeType == 3) aNode = aNode.parentNode;
- var toggle = true;
- var flasher = getFlasher();
+ let toggle = true;
+ let flasher = getFlasher();
function setOutline(){
- if(toggle){
+ if (toggle){
flasher.drawElementOutline(aNode);
- }else {
+ } else {
flasher.repaintElement(aNode);
}
toggle = !toggle;
}
- for (var i=1; i<7; ++i){
+ for (let i=1; i<7; ++i){
setTimeout(setOutline, i * 100);
}
}
commands.addUserCommand(['xpathb[link]','xb'],'XPath blink nodes',
function(expression){
- var result
+ let result;
try {
result = util.evaluateXPath(expression.string);
} catch(e) {
@@ -65,7 +67,7 @@ commands.addUserCommand(['xpathb[link]','xb'],'XPath blink nodes',
liberator.echo('XPath blink: none');
return;
}
- for (var i=0; i