Changeset 3706:170617361020 for themes
- Timestamp:
- 02/16/18 16:01:59 (7 years ago)
- Branch:
- default
- Location:
- themes
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
themes/berlin/tpl/user_footer.html
r3427 r3706 1 1 <script type="text/javascript"> 2 $("html").addClass("js"); 3 // Show/Hide main menu 4 $(".header__nav"). 5 before('<button id="hamburger" type="button"><span class="visually-hidden">' + dotclear_berlin_navigation + '</span></button>'). 6 toggle(); 7 $("#hamburger").click(function() { 8 $(this).toggleClass("open"); 9 $(".header__nav").toggle('easing'); 10 }); 11 // Show/Hide sidebar on small screens 12 $("#main").prepend('<button id="offcanvas-on" type="button"><span class="visually-hidden">' + dotclear_berlin_show_menu + '</span></button>'); 13 $("#offcanvas-on").click(function() { 14 var btn = $('<button id="offcanvas-off" type="button"><span class="visually-hidden">' + dotclear_berlin_hide_menu + '</span></button>'); 15 $("#wrapper").addClass("off-canvas"); 16 $("#footer").addClass("off-canvas"); 17 $("#sidebar").prepend(btn); 18 btn.click(function(evt) { 19 $("#wrapper").removeClass("off-canvas"); 20 $("#footer").removeClass("off-canvas"); 21 evt.target.remove(); 22 }); 23 }); 24 $(document).ready(function() { 25 // totop scroll 26 $(window).scroll(function() { 27 if ($(this).scrollTop() != 0) { 28 $('#gotop').fadeIn(); 29 } else { 30 $('#gotop').fadeOut(); 31 } 32 }); 33 $('#gotop').click(function(e) { 34 $('body,html').animate({ 35 scrollTop: 0 36 }, 800); 37 e.preventDefault(); 38 }); 39 }); 2 'use strict'; 3 $('html').addClass('js'); 4 // Show/Hide main menu 5 $('.header__nav'). 6 before('<button id="hamburger" type="button"><span class="visually-hidden">' + dotclear_berlin_navigation + '</span></button>'). 7 toggle(); 8 $('#hamburger').click(function() { 9 $(this).toggleClass('open'); 10 $('.header__nav').toggle('easing'); 11 }); 12 // Show/Hide sidebar on small screens 13 $('#main').prepend('<button id="offcanvas-on" type="button"><span class="visually-hidden">' + dotclear_berlin_show_menu + '</span></button>'); 14 $('#offcanvas-on').click(function() { 15 var btn = $('<button id="offcanvas-off" type="button"><span class="visually-hidden">' + dotclear_berlin_hide_menu + '</span></button>'); 16 $('#wrapper').addClass('off-canvas'); 17 $('#footer').addClass('off-canvas'); 18 $('#sidebar').prepend(btn); 19 btn.click(function(evt) { 20 $('#wrapper').removeClass('off-canvas'); 21 $('#footer').removeClass('off-canvas'); 22 evt.target.remove(); 23 }); 24 }); 25 $(document).ready(function() { 26 // totop scroll 27 $(window).scroll(function() { 28 if ($(this).scrollTop() != 0) { 29 $('#gotop').fadeIn(); 30 } else { 31 $('#gotop').fadeOut(); 32 } 33 }); 34 $('#gotop').click(function(e) { 35 $('body,html').animate({ 36 scrollTop: 0 37 }, 800); 38 e.preventDefault(); 39 }); 40 }); 40 41 </script> -
themes/default/js/post.js
r2633 r3706 1 /*global $, post_remember_str */ 2 'use strict'; 3 1 4 $(function() { 2 3 4 5 6 7 5 $('#comment-form p:has(input[type=submit][name=preview],button[type=submit][name=preview])'). 6 before( 7 '<p class="remember"><input type="checkbox" id="c_remember" name="c_remember" /> ' + 8 '<label for="c_remember">' + post_remember_str + '</label>' + 9 '</p>' 10 ); 8 11 9 12 var cookie = readCookie($.cookie('comment_info')); 10 13 14 if (cookie != false) { 15 $('#c_name').val(cookie[0]); 16 $('#c_mail').val(cookie[1]); 17 $('#c_site').val(cookie[2]); 18 $('#c_remember').attr('checked', 'checked'); 19 } 11 20 12 if (cookie != false) { 13 $('#c_name').val(cookie[0]); 14 $('#c_mail').val(cookie[1]); 15 $('#c_site').val(cookie[2]); 16 $('#c_remember').attr('checked','checked'); 17 } 21 $('#c_remember').click(function() { 22 if (this.checked) { 23 setCookie(); 24 } else { 25 dropCookie(); 26 } 27 }); 18 28 19 $('#c_remember').click(function() { 20 if (this.checked) { 21 setCookie(); 22 } else { 23 dropCookie(); 24 } 25 }); 29 $('#c_name').change(function() { 30 if ($('#c_remember').get(0).checked) { 31 setCookie(); 32 } 33 }); 26 34 27 $('#c_name').change(function() {28 29 30 31 35 $('#c_mail').change(function() { 36 if ($('#c_remember').get(0).checked) { 37 setCookie(); 38 } 39 }); 32 40 33 $('#c_mail').change(function() {34 35 36 37 41 $('#c_site').change(function() { 42 if ($('#c_remember').get(0).checked) { 43 setCookie(); 44 } 45 }); 38 46 39 $('#c_site').change(function() { 40 if ($('#c_remember').get(0).checked) { 41 setCookie(); 42 } 43 }); 47 function setCookie() { 48 var name = $('#c_name').val(); 49 var mail = $('#c_mail').val(); 50 var site = $('#c_site').val(); 51 var cpath = $('link[rel=top]').attr('href'); 52 if (!cpath) { 53 cpath = '/'; 54 } else { 55 cpath = cpath.replace(/.*:\/\/[^\/]*([^?]*).*/g, '$1'); 56 } 44 57 45 function setCookie() { 46 var name = $('#c_name').val(); 47 var mail = $('#c_mail').val(); 48 var site = $('#c_site').val(); 49 var cpath = $('link[rel=top]').attr('href'); 50 if (!cpath) { 51 cpath = "/"; 52 } else { 53 cpath = cpath.replace(/.*:\/\/[^\/]*([^?]*).*/g,"$1"); 54 } 58 $.cookie('comment_info', name + '\n' + mail + '\n' + site, { 59 expires: 60, 60 path: cpath 61 }); 62 } 55 63 56 $.cookie('comment_info', name + '\n' + mail + '\n' + site, {expires: 60, path: cpath}); 57 } 64 function dropCookie() { 65 $.cookie('comment_info', '', { 66 expires: -30, 67 path: '/' 68 }); 69 } 58 70 59 function dropCookie() { 60 $.cookie('comment_info','',{expires: -30, path: '/'}); 61 } 71 function readCookie(c) { 72 if (!c) { 73 return false; 74 } 62 75 63 function readCookie(c) { 64 if (!c) { 65 return false; 66 } 76 var s = c.split('\n'); 67 77 68 var s = c.split('\n'); 78 if (s.length != 3) { 79 dropCookie(); 80 return false; 81 } 69 82 70 if (s.length != 3) { 71 dropCookie(); 72 return false; 73 } 74 75 return s; 76 } 83 return s; 84 } 77 85 }); -
themes/ductile/ductile.js
r2566 r3706 1 /*global $ */ 2 'use strict'; 3 1 4 $(function() { 2 5 var create_name = function(text) { 3 6 4 5 7 // Convert text to lower case. 8 var name = text.toLowerCase(); 6 9 7 8 9 10 // Remove leading and trailing spaces, and any non-alphanumeric 11 // characters except for ampersands, spaces and dashes. 12 name = name.replace(/^\s+|\s+$|[^a-z0-9&\s-]/g, ''); 10 13 11 12 14 // Replace '&' with 'and'. 15 name = name.replace(/&/g, 'and'); 13 16 14 15 17 // Replaces spaces with dashes. 18 name = name.replace(/\s/g, '-'); 16 19 17 18 name = name.replace(/(-)+\1/g, "$1");20 // Squash any duplicate dashes. 21 name = name.replace(/(-)+\1/g, '$1'); 19 22 20 21 23 return name; 24 }; 22 25 23 26 var add_link = function() { 24 27 25 26 27 28 // Convert the h2 element text into a value that 29 // is safe to use in a name attribute. 30 var name = create_name($(this).text()); 28 31 29 30 31 32 // Create a name attribute in the following sibling 33 // to act as a fragment anchor. 34 $(this).next().attr('name', name); 32 35 33 34 35 36 37 38 39 40 36 // Replace the h2.toggle element with a link to the 37 // fragment anchor. Use the h2 text to create the 38 // link title attribute. 39 $(this).html( 40 '<a href="#' + name + '" title="Reveal ' + 41 $(this).text() + ' content">' + 42 $(this).html() + '</a>'); 43 }; 41 44 42 43 45 var toggle = function(event) { 46 event.preventDefault(); 44 47 45 46 47 48 49 50 48 // Toggle the 'expanded' class of the h2.toggle 49 // element, then apply the slideToggle effect 50 // to all siblings. 51 $(this).toggleClass('expanded'). 52 nextAll().slideToggle('fast'); 53 }; 51 54 52 53 54 55 55 var remove_focus = function() { 56 // Use the blur() method to remove focus. 57 $(this).blur(); 58 }; 56 59 57 $(document).ready (function() {58 60 $(document).ready(function() { 61 if ($(window).width() < 1024) { 59 62 60 61 $("#sidebar div div h2").addClass('toggle');63 // Set toggle class to each #sidebar h2 64 $('#sidebar div div h2').addClass('toggle'); 62 65 63 64 66 // Hide all h2.toggle siblings 67 $('#sidebar div div h2').nextAll().hide(); 65 68 66 67 69 // Add a link to each h2.toggle element. 70 $('h2.toggle').each(add_link); 68 71 69 70 72 // Add a click event handler to all h2.toggle elements. 73 $('h2.toggle').click(toggle); 71 74 72 73 74 75 }) 75 // Remove the focus from the link tag when accessed with a mouse. 76 $('h2.toggle a').mouseup(remove_focus); 77 } 78 }); 76 79 77 80 });
Note: See TracChangeset
for help on using the changeset viewer.