Created
December 19, 2012 04:01
-
-
Save arkadylukashov/4334298 to your computer and use it in GitHub Desktop.
Revisions
-
arkadylukashov revised this gist
Dec 19, 2012 . 2 changed files with 10 additions and 8 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -15,8 +15,11 @@ settings.full = selector[0].innerText; $(this).on('click',function() { if (!methods.is()) { if (methods.enter()) { selector[0].innerText = settings.exit; } else { settings.onFail(); } } else { selector[0].innerText = settings.full; return methods.exit(); @@ -33,16 +36,16 @@ enter : function() { if (document.documentElement.requestFullscreen) { document.documentElement.requestFullscreen(); return true; } else if (document.documentElement.mozRequestFullScreen) { document.documentElement.mozRequestFullScreen(); return true; } else if (document.documentElement.webkitRequestFullScreen) { document.documentElement.webkitRequestFullScreen(); return true; } else { return false; } }, This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,2 +1 @@ (function(a){a.fn.fullscreen=function(e){var b=a.extend({to:!1,exit:"Normal size",onScreenChange:a.noop,onFail:a.noop},e),c={run:function(){var d=!b.to?this:a(this).find(b.to);b.full=d[0].innerText;a(this).on("click",function(){if(c.is())return d[0].innerText=b.full,c.exit();if(c.enter())d[0].innerText=b.exit;else b.onFail()});a(document).on("fullscreenchange mozfullscreenchange webkitfullscreenchange",function(){return b.onScreenChange(c.is())})},is:function(){return document.fullscreen||document.fullscreenElement||document.mozFullScreen||document.webkitIsFullScreen||!1},enter:function(){return document.documentElement.requestFullscreen?(document.documentElement.requestFullscreen(),!0):document.documentElement.mozRequestFullScreen?(document.documentElement.mozRequestFullScreen(),!0):document.documentElement.webkitRequestFullScreen?(document.documentElement.webkitRequestFullScreen(),!0):!1},exit:function(){document.exitFullscreen?document.exitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitCancelFullScreen&&document.webkitCancelFullScreen()}};return c.run.call(this)}})(jQuery); -
arkadylukashov revised this gist
Dec 19, 2012 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,2 @@ (function(a){a.fn.fullscreen=function(e){var b=a.extend({to:!1,exit:"Normal Size",onScreenChange:a.noop,onFail:a.noop},e),c={run:function(){var d=!b.to?this:a(this).find(b.to);b.full=d[0].innerText;a(this).on("click",function(){if(c.is())return d[0].innerText=b.full,c.exit();d[0].innerText=b.exit;return c.enter()});a(document).on("fullscreenchange mozfullscreenchange webkitfullscreenchange",function(){return b.onScreenChange(c.is())})}, is:function(){return document.fullscreen||document.fullscreenElement||document.mozFullScreen||document.webkitIsFullScreen||!1},enter:function(){if(document.documentElement.requestFullscreen)document.documentElement.requestFullscreen();else if(document.documentElement.mozRequestFullScreen)document.documentElement.mozRequestFullScreen();else if(document.documentElement.webkitRequestFullScreen)document.documentElement.webkitRequestFullScreen();else return b.onFail()},exit:function(){document.exitFullscreen? document.exitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitCancelFullScreen&&document.webkitCancelFullScreen()}};return c.run.call(this)}})(jQuery); -
arkadylukashov created this gist
Dec 19, 2012 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,66 @@ (function($) { $.fn.fullscreen = function(options) { var settings = $.extend({ to: false, exit: 'Normal size', onScreenChange: $.noop, onFail: $.noop },options); var methods = { run: function() { var selector = !settings.to ? this : $(this).find(settings.to); settings.full = selector[0].innerText; $(this).on('click',function() { if (!methods.is()) { selector[0].innerText = settings.exit; return methods.enter(); } else { selector[0].innerText = settings.full; return methods.exit(); } }); $(document).on('fullscreenchange mozfullscreenchange webkitfullscreenchange', function() { return settings.onScreenChange( methods.is() ); }) }, is : function() { return document.fullscreen || document.fullscreenElement || document.mozFullScreen || document.webkitIsFullScreen || false; }, enter : function() { if (document.documentElement.requestFullscreen) { document.documentElement.requestFullscreen(); } else if (document.documentElement.mozRequestFullScreen) { document.documentElement.mozRequestFullScreen(); } else if (document.documentElement.webkitRequestFullScreen) { document.documentElement.webkitRequestFullScreen(); } else { return settings.onFail(); } }, exit : function() { if (document.exitFullscreen) { document.exitFullscreen(); } else if (document.mozCancelFullScreen) { document.mozCancelFullScreen(); } else if (document.webkitCancelFullScreen) { document.webkitCancelFullScreen(); } } }; return methods.run.call(this); } })(jQuery)