From 0221a17d58a198bc9bcc16e89e25e60d631d82e7 Mon Sep 17 00:00:00 2001 From: Charles Connell Date: Fri, 20 Dec 2013 19:53:45 -0500 Subject: [PATCH] Zoom buttons on notes --- karmaworld/assets/js/note-iframe.js | 53 ++++++++++++++++----- karmaworld/templates/base.html | 2 +- karmaworld/templates/notes/note_detail.html | 4 +- 3 files changed, 44 insertions(+), 15 deletions(-) diff --git a/karmaworld/assets/js/note-iframe.js b/karmaworld/assets/js/note-iframe.js index 22f7bea..48ec0c7 100644 --- a/karmaworld/assets/js/note-iframe.js +++ b/karmaworld/assets/js/note-iframe.js @@ -1,15 +1,42 @@ - // resize the iframe based on internal contents on page load - function autoResize(id){ - var newheight; - var newwidth; - - if(document.getElementById){ - newheight = document.getElementById(id).contentWindow.document .body.scrollHeight; - newwidth = document.getElementById(id).contentWindow.document .body.scrollWidth; - } - - document.getElementById(id).height = (newheight+ 10) + "px"; - document.getElementById(id).width= (newwidth + 5) + "px"; - //alert('height: ' + newheight); +// resize the iframe based on internal contents on page load +function autoResize(id){ + var newheight; + var newwidth; + + if(document.getElementById){ + newheight = document.getElementById(id).contentWindow.document .body.scrollHeight; + newwidth = document.getElementById(id).contentWindow.document .body.scrollWidth; } + document.getElementById(id).height = (newheight+ 10) + "px"; + document.getElementById(id).width= (newwidth + 5) + "px"; + + + var currFFZoom = 1; + var currIEZoom = 100; + var frameBody = $('#noteframe').contents().find('body'); + + $('#plus-btn').on('click',function(){ + if ($.browser.mozilla){ + var step = 0.25; + currFFZoom += step; + frameBody.css('MozTransform','scale(' + currFFZoom + ')'); + } else { + var step = 25; + currIEZoom += step; + frameBody.css('zoom', ' ' + currIEZoom + '%'); + } + }); + + $('#minus-btn').on('click',function(){ + if ($.browser.mozilla){ + var step = 0.25; + currFFZoom -= step; + frameBody.css('MozTransform','scale(' + currFFZoom + ')'); + } else { + var step = 25; + currIEZoom -= step; + frameBody.css('zoom', ' ' + currIEZoom + '%'); + } + }); +} diff --git a/karmaworld/templates/base.html b/karmaworld/templates/base.html index 40c657a..0f2d719 100644 --- a/karmaworld/templates/base.html +++ b/karmaworld/templates/base.html @@ -14,7 +14,7 @@ - + diff --git a/karmaworld/templates/notes/note_detail.html b/karmaworld/templates/notes/note_detail.html index 4c4c294..5eadb1c 100644 --- a/karmaworld/templates/notes/note_detail.html +++ b/karmaworld/templates/notes/note_detail.html @@ -32,8 +32,10 @@
-
+

+ +
-- 2.25.1