From: Charles Connell Date: Sat, 21 Dec 2013 00:53:45 +0000 (-0500) Subject: Zoom buttons on notes X-Git-Tag: release-20150131~372 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=0221a17d58a198bc9bcc16e89e25e60d631d82e7;p=oweals%2Fkarmaworld.git Zoom buttons on notes --- 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 @@
-
+

+ +