Permalink
Browse files

remove inline script

  • Loading branch information...
maripo committed Aug 31, 2012
1 parent 2e5376e commit 37d87aa8a0f73eaf3d1a853b6f0c076d5228a6ec
Showing with 17 additions and 6 deletions.
  1. +5 −5 index.html
  2. +12 −1 src/index.js
View
@@ -11,12 +11,12 @@
<script type="text/javascript" src="src/uuid.js"></script>
<title>CustomBlocker</title>
</head>
- <body style="width:480px;" onload="getAppliedRules()">
+ <body style="width:480px;">
<div id="header">
<div class="menu">
- <input type="radio" name="extenstion_enable" id="buttonOn" onclick="setBlockOn(true)"/>
+ <input type="radio" name="extenstion_enable" id="buttonOn"/>
<label for="">ON</label>
- <input type="radio" name="extenstion_enabled" id="buttonOff" onclick="setBlockOn(false)"/>
+ <input type="radio" name="extenstion_enabled" id="buttonOff" />
<label for="">OFF</label>
<a href="javascript:void(0)" onclick="openPreference()"><span class="custom_filter_localize_preference">Preference</span></a>
</div>
@@ -30,12 +30,12 @@ <h2><span class="custom_filter_localize_activeRules">Active Rules</span></h2>
<ul id="activeRules">
</ul>
<div id="ruleSectionFooter">
- <a href="javascript:void(0)" onclick="openPreference()"><span class="custom_filter_localize_preference">Preference</span></a>
+ <a href="#" id="buttonOpenPreference"><span class="custom_filter_localize_preference">Preference</span></a>
</div>
</div>
<div>
- <input id="buttonCreateRule" type="button" onclick="openRuleEditor()" value="Create a new rule for this site" class="custom_filter_localize_newRuleForThisSite"/>
+ <input id="buttonCreateRule" type="button" value="Create a new rule for this site" class="custom_filter_localize_newRuleForThisSite"/>
</div>
</div>
<script type="text/javascript" src="src/index.js"></script>
View
@@ -168,4 +168,15 @@ function getDisableAction (rule, disableButton)
document.write(ex);
}
}
-}
+}
+
+window.onload = function ()
+{
+ getAppliedRules();
+ document.getElementById('buttonOn').addEventListener ('click',
+ function(){ setBlockOn(true); }, false);
+ document.getElementById('buttonOff').addEventListener ('click',
+ function(){ setBlockOn(false); }, false);
+ document.getElementById('buttonOpenPreference').addEventListener('click', openPreference, false);
+ document.getElementById('buttonCreateRule').addEventListener('click', openRuleEditor, false);
+}

0 comments on commit 37d87aa

Please sign in to comment.