Last active
March 5, 2016 17:29
-
-
Save yuizho/40592d3b65c366821144 to your computer and use it in GitHub Desktop.
chrome_plugin
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
(function() { | |
var click = function() { | |
alert("入れ替え後のイベント"); | |
}; | |
var load = function() { | |
// htmlの書き換え | |
var h1 = document.createElement('h3'); | |
h1.setAttribute("class", "message"); | |
h1.innerHTML = "checkerが有効です"; | |
document.body.insertBefore(h1, document.body.firstChild); | |
// イベントの挿入 | |
var btns = document.querySelectorAll('button'); | |
for(var i=0, len=btns.length; i < len; i++) { | |
btns[i].addEventListener("click", click, false); | |
} | |
}; | |
document.addEventListener("DOMContentLoaded", load, false); | |
}()); |
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
<html> | |
<head> | |
<script> | |
(function() { | |
var click = function() { | |
alert("元のイベント"); | |
} | |
var load = function() { | |
var btns = document.querySelectorAll('button'); | |
for(var i=0, len=btns.length; i < len; i++) { | |
btns[i].addEventListener("click", click, false); | |
} | |
}; | |
document.addEventListener("DOMContentLoaded", load, false); | |
}()); | |
</script> | |
</head> | |
<body> | |
<button>OK</button> | |
</body> | |
</html> |
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
{ | |
"manifest_version": 2, | |
"name": "checker", | |
"description": "checker", | |
"version": "0.1", | |
"content_scripts": [{ | |
"matches": [ | |
"http://*/*", | |
"https://*/*", | |
"file://*/*" | |
], | |
"js": ["checker.js"], | |
"run_at": "document_start" | |
}] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment