Permalink
Browse files

small fix on selecting message frame

  • Loading branch information...
1 parent 1bdeb9c commit 12b9fa95dcf812bceb747fc2534fa6194fec41df @yufeiliu committed Apr 3, 2012
Showing with 15 additions and 3 deletions.
  1. +2 −1 src/gcipher.js
  2. +13 −2 web/index.html
View
@@ -11,7 +11,8 @@
var pw = prompt("What is the password?");
var c = new Blowfish(pw);
var doc = document.querySelector("#canvas_frame").contentWindow.document;
- var msgFrame = doc.querySelectorAll("iframe")[1];
+ var allFrames = doc.querySelectorAll("iframe");
+ var msgFrame = allFrames[allFrames.length-1];
if (typeof(msgFrame)==="undefined") {
var msgContainers = doc.querySelectorAll("div.ii");
for (var i = 0; i < msgContainers.length; i++) {
View
@@ -33,8 +33,8 @@ <h1>gcipher</h1>
<h2>Usage</h2>
-<p><a class="prominent" href='javascript:(function(){if(/^https:\/\/mail\.google\.com/.test(document.location.href)){var e=function(){var c=prompt("What is the password?"),c=new Blowfish(c),a=document.querySelector("#canvas_frame").contentWindow.document,b=a.querySelectorAll("iframe")[1];if("undefined"===typeof b){a=a.querySelectorAll("div.ii");for(b=0;b<a.length;b++){var d=a[b].children[0];"undefined"!==typeof d&&"{Encrypted with gcipher}"===d.innerHTML.substr(0,24)&&(d.innerHTML=c.decrypt(d.innerHTML.substr(24).replace(/<wbr>/g,"").replace(/\n/g,
-"")))}}else a=b.contentWindow.document.querySelector("body.editable"),a.innerHTML="{Encrypted with gcipher}"+c.encrypt(a.innerHTML)};null===document.getElementById("blowfish-js")?(s=document.createElement("script"),s.setAttribute("src","https://raw.github.com/yufeiliu/blowfish.js/master/blowfish.js"),s.setAttribute("id","blowfish-js"),s.onload=e,document.body.appendChild(s)):e()}else alert("gcipher only works on the Gmail web interface!")})();'>gcipher!</a></p>
+<p><a class="prominent" href='javascript:(function(){if(/^https:\/\/mail\.google\.com/.test(document.location.href)){var e=function(){var c=prompt("What is the password?"),c=new Blowfish(c),b=document.querySelector("#canvas_frame").contentWindow.document,a=b.querySelectorAll("iframe"),a=a[a.length-1];if("undefined"===typeof a){b=b.querySelectorAll("div.ii");for(a=0;a<b.length;a++){var d=b[a].children[0];"undefined"!==typeof d&&"{Encrypted with gcipher}"===d.innerHTML.substr(0,24)&&(d.innerHTML=c.decrypt(d.innerHTML.substr(24).replace(/<wbr>/g,
+"").replace(/\n/g,"")))}}else b=a.contentWindow.document.querySelector("body.editable"),b.innerHTML="{Encrypted with gcipher}"+c.encrypt(b.innerHTML)};null===document.getElementById("blowfish-js")?(s=document.createElement("script"),s.setAttribute("src","https://raw.github.com/yufeiliu/blowfish.js/master/blowfish.js"),s.setAttribute("id","blowfish-js"),s.onload=e,document.body.appendChild(s)):e()}else alert("gcipher only works on the Gmail web interface!")})();'>gcipher!</a></p>
<p>To use it, drag the button to your bookmarks. After writing an email in the Gmail web interface, click the bookmarked button to encrypt your email before sending. gcipher will ask you for a password.</p>
@@ -53,4 +53,15 @@ <h2>Is it really secure?</h2>
</div>
<!--[if !IE]><script>fixScale(document);</script><!--<![endif]-->
</body>
+ <script>
+ var _gaq = _gaq || [];
+ _gaq.push(['_setAccount', 'UA-8942926-1']);
+ _gaq.push(['_trackPageview']);
+
+ (function() {
+ var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
+ ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
+ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
+ })();
+ </script>
</html>

0 comments on commit 12b9fa9

Please sign in to comment.