--[[ ViewLinks
luamacro(ViewLinks, Page Links)
luamacro(ListLinks, List Links)
]]
require "javascript"
function ViewLinks()
javascript.popup([[javascript:
LnkW=open('','LnkW','width=600,height=300,scrollbars,resizable');
sLFw=window.name;
if(!sLFw){
sLFw=window.name='sLFw'
};
sLFd=document;
DlnK=document.links;
with(LnkW.document){
write(''+DlnK.length+' total links from:
'
+sLFd.title+'
'+sLFd.URL.link(sLFd.URL)+'
');
for(lNK=0;lNK'+DlnK[lNK].text+'
'+DlnK[lNK].href.link(DlnK[lNK]))
};
close();
LnkW.focus()
}]])
end
function ListLinks()
javascript.popup([[javascript:
LnkW=open('','LnkW','width=600,height=300,scrollbars,resizable');
sLFw=window.name;
if(!sLFw){
sLFw=window.name='sLFw'
};
sLFd=document;
DlnK=document.links;
LstL={};
with(LnkW.document){
write(''+DlnK.length+' total links from:
'
+sLFd.title+'
'+sLFd.URL.link(sLFd.URL)+'
');
for(lNK=0;lNK');
LstL[DlnK[lNK].href] = 1;
}
};
close();
LnkW.focus()
}]])
end
function ViewSelection()
local pref=getpref(TYPE_BOOL,"dom.disable_open_during_load")
setpref(TYPE_BOOL,"dom.disable_open_during_load",true);
javascript.popup([[javascript:
html_selection=document.createElement('div');
if (window.getSelection().rangeCount>0){html_selection.appendChild(window.getSelection().getRangeAt(0).cloneContents())};
scripts = html_selection.getElementsByTagName('SCRIPT');
for(i=scripts.length-1; i>=0; i--){scripts[i].parentNode.removeChild(scripts[i])};
s_old=html_selection.innerHTML.replace(/<\/(TEXTAREA>)/ig, '</$1');
if (html_selection.firstChild.nodeName=='TH' || html_selection.firstChild.nodeName=='TR' ||
html_selection.firstChild.nodeName=='TD' || html_selection.firstChild.nodeName=='TBODY'){
r=document.createRange();r.setStartBefore(html_selection.firstChild);r.setEndAfter(html_selection.lastChild);
t=document.createElement('table');r.surroundContents(t);
r.detach();
html_selection.firstChild.border='1';
html_selection.firstChild.width='100%';
}
s_new=html_selection.innerHTML.replace(/