1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
|
function Plugin(){
function init() {
alert("init");
var appcontent = document.getElementById("appcontent"); // navigateur
if(appcontent)
appcontent.addEventListener("load", this.ScanPage, true);
ScanPage();
}
onPageLoad:function ScanPage()
{
//if(doc.location.href.search("forum") > -1)
alert("fonctionScanPage");
if(document.url;indexof("profil"))//check if that's a correct page
{
var imgUrl="http://192.168.11.65/api/state?number="
var number="";
var regexp = new RegExp("[0-9]{4,10}","gi")
var newcode = document.createElement("span");
var oldcode=document.getElementByID("contactInfoSubArea");//get the div node
alert("ScanPage");
if (Expression.test(oldcode))
{//tel number present on the page
alert("ScanPage : Expression found");
//var numbernode=oldcode.firstChild.childNodes[0].childNodes[0].childNodes[0].childNodes[1];//office PhoneNumber
//var number=oldcode.firstChild.firstChild.firstChild.firstChild.childNodes[1].nodeValue;
var pnode = document.getElementsByTagName("p");
var Number=pnode[6].nodeValue;//node office number
// Now we create the link
var texte=document.createTextNode(Number);
var img.src=imgUrl;
img.src+=Number;
newcode.appendChild(texte);
newcode.appendChild(img);
newcode.setAttribute("style","cursor:pointer; color:#105cb6;");
newcode.addEventListener("click", dial, true);
parent.replaceChild(newcode, pnode);//put the new node
}
}
}
var plugin = new Plugin();
alert("fct.js");
window.addEventListener("load", function() { plugin.init(); }, false);
} |
Partager