Changeset 1503963
- Timestamp:
- 09/27/2016 07:05:17 PM (9 years ago)
- Location:
- update-from-bottom
- Files:
-
- 4 edited
-
tags/1.0.3/readme.txt (modified) (1 diff)
-
trunk/js/update-from-bottom.admin.js (modified) (1 diff)
-
trunk/readme.txt (modified) (1 diff)
-
trunk/update-from-bottom.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
update-from-bottom/tags/1.0.3/readme.txt
r1162822 r1503963 1 1 === Update from Bottom === 2 2 Contributors: urre 3 Donate link: https://www.paypal.me/urbansanden 3 4 Tags: top, scroll, bottom, publish, down, scrolldown 4 5 Requires at least: 3.0 5 Tested up to: 4. 2.26 Tested up to: 4.6.1 6 7 Stable tag: 1.0.3 7 8 -
update-from-bottom/trunk/js/update-from-bottom.admin.js
r997093 r1503963 1 1 (function ($) { 2 "use strict";3 2 4 $(window).load( function() { 3 'use strict'; 5 4 6 // Button markup depending on post/page status 7 if($('#publish').val() == updatefrombottomParams.publish) { 8 $('<div id="updatefrombottom"><a class="button button-totop">'+updatefrombottomParams.totop+'</a><a class="button button-primary button-large">'+updatefrombottomParams.publish+'</a></div>').appendTo("#wpbody-content"); 9 } else { 10 $('<div id="updatefrombottom"><a class="button button-totop">'+updatefrombottomParams.totop+'</a><a class="button button-primary button-large">'+updatefrombottomParams.update+'</a></div>').appendTo("#wpbody-content"); 11 } 5 var UpdateFromBottom = { 12 6 13 // DOM Caching 14 var elements ={15 box : $('#updatefrombottom'),16 heart : $('#jsc-heart'),17 update : $('#updatefrombottom .button-primary'),18 publish: $('#publish'),19 totop : $('#updatefrombottom .button-totop') 20 } 7 // Settings 8 settings : { 9 box : null, 10 heart : null, 11 update : null, 12 publish: null, 13 totop : null, 14 }, 21 15 22 // Publish/Update content 23 elements.update.on('click', function(e){ 16 publish: function() { 24 17 25 if($(this).text() == updatefrombottomParams.publish) { 26 $(this).text(updatefrombottomParams.publishing); 27 setTimeout(function() { 28 $(this).text(updatefrombottomParams.publish); 29 }, 2000); 30 } else { 31 $(this).text(updatefrombottomParams.updating); 32 setTimeout(function() { 33 $(this).text(updatefrombottomParams.update); 34 }, 2000); 35 } 18 // Publish/Update content 19 UpdateFromBottom.settings.update.on('click', function(e){ 36 20 37 elements.publish.trigger('click'); 21 if($(this).text() == updatefrombottomParams.publish) { 22 $(this).text(updatefrombottomParams.publishing); 23 setTimeout(function() { 24 $(this).text(updatefrombottomParams.publish); 25 }, 2000); 26 } else { 27 $(this).text(updatefrombottomParams.updating); 28 setTimeout(function() { 29 $(this).text(updatefrombottomParams.update); 30 }, 2000); 31 } 38 32 39 e.preventDefault();33 UpdateFromBottom.settings.publish.trigger('click'); 40 34 41 });35 e.preventDefault(); 42 36 43 // Scroll to top 44 elements.totop.on('click', function(event){ 45 event.preventDefault(); 46 $('html, body').animate({scrollTop : 0}, 600); 47 }); 37 }); 38 }, 48 39 49 // Check if we are near bottom, show box 50 $(window).scroll(function(){ 51 if($(window).scrollTop() + $(window).height() > $(document).height() - 40) { 52 elements.box.show(); 40 scrollToTop: function() { 53 41 54 } else { 55 elements.box.hide(); 56 } 57 }); 42 // Scroll to top 43 UpdateFromBottom.settings.totop.on('click', function(event){ 44 event.preventDefault(); 45 $('html, body').animate({scrollTop : 0}, 600); 46 }); 58 47 59 // Show box on wide screens 60 $(window).on('resize', function() { 48 }, 61 49 62 if($(window).width() > 900 && $(window).height() > 1000) { 63 elements.box.show(); 64 } else { 65 elements.box.hide(); 66 } 50 showBox: function() { 67 51 68 }); 52 // Show box if near bottom 53 if(($(window).scrollTop() + $(window).height()) > ($(document).height() - 40)) { 54 UpdateFromBottom.settings.box.show(); 55 } else { 56 UpdateFromBottom.settings.box.hide(); 57 } 58 }, 69 59 70 }); 60 showBoxOnWide: function() { 61 62 // Show box if neccessary 63 if($(window).width() > 900 && $(window).height() > 1000) { 64 UpdateFromBottom.settings.box.show(); 65 } else { 66 UpdateFromBottom.settings.box.hide(); 67 } 68 69 }, 70 71 AlternateMarkup: function() { 72 // Button markup depending on post/page status 73 if($('#updatefrombottom .button-primary').val() == updatefrombottomParams.publish) { 74 $('<div id="updatefrombottom"><a class="button button-totop">'+updatefrombottomParams.totop+'</a><a class="button button-primary button-large">'+updatefrombottomParams.publish+'</a></div>').appendTo("#wpbody-content"); 75 } else { 76 $('<div id="updatefrombottom"><a class="button button-totop">'+updatefrombottomParams.totop+'</a><a class="button button-primary button-large">'+updatefrombottomParams.update+'</a></div>').appendTo("#wpbody-content"); 77 } 78 79 // Store selectors to settings 80 UpdateFromBottom.settings.box = $('#updatefrombottom'); 81 UpdateFromBottom.settings.heart = $('#jsc-heart'); 82 UpdateFromBottom.settings.update = $('#updatefrombottom .button-primary'); 83 UpdateFromBottom.settings.publish = $('#publish'); 84 UpdateFromBottom.settings.totop = $('#updatefrombottom .button-totop'); 85 86 87 } 88 89 } 90 91 $(window).load(function() { 92 93 // Alternate markup 94 UpdateFromBottom.AlternateMarkup(); 95 96 setTimeout(function() { 97 98 // Scroll to top 99 UpdateFromBottom.scrollToTop(); 100 101 // Publish/Update 102 UpdateFromBottom.publish(); 103 104 }, 1000); 105 106 }); 107 108 $(window).scroll(function() { 109 110 // Check if we are near bottom, show box 111 UpdateFromBottom.showBox(); 112 113 }); 114 115 $(window).on('resize', function() { 116 117 // Show box on wide screens 118 UpdateFromBottom.showBoxOnWide(); 119 120 }); 71 121 72 122 }(jQuery)); -
update-from-bottom/trunk/readme.txt
r1162822 r1503963 1 1 === Update from Bottom === 2 2 Contributors: urre 3 Donate link: http ://urre.me/donate3 Donate link: https://www.paypal.me/urbansanden 4 4 Tags: top, scroll, bottom, publish, down, scrolldown 5 5 Requires at least: 3.0 6 Tested up to: 4. 2.26 Tested up to: 4.6.1 7 7 Stable tag: 1.0.3 8 8 -
update-from-bottom/trunk/update-from-bottom.php
r1147036 r1503963 101 101 $ufb = new UpdatefromBottom(); 102 102 endif; 103 104 ?>
Note: See TracChangeset
for help on using the changeset viewer.