Created
August 31, 2010 13:28
-
-
Save erwan/559009 to your computer and use it in GitHub Desktop.
Chrome Screencast 1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var phoneRe = /^\s*((\d{2}\s?){5})\s*$/; | |
var texts = document.evaluate(".//text()[normalize-space(.)!='']", document.body, null, 6, null); | |
for (var i = 0; i < texts.snapshotLength; i++) { | |
var textNode = texts.snapshotItem(i); | |
var text = textNode.textContent; | |
var m = phoneRe.exec(text); | |
if (m != null) { | |
var newText = document.createElement("a"); | |
newText.setAttribute("href", "callto:" + m[1]); | |
newText.appendChild(document.createTextNode(m[0])); | |
textNode.parentNode.replaceChild(newText, textNode); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "Telify", | |
"version": "0.1", | |
"description": "Click to call", | |
"background_page": "background.html", | |
"content_scripts": [{ | |
"js": ["contentScript.js"], | |
"matches": ["http://*/*"] | |
}] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment