hugosoucycc

[ARCHIVED] Another old source code of <hugo.soucy.cc>.
Log | Files | Refs | Submodules

commit e1c24243fcd684f2f25ba4dbaada99d9dad1fe0d
parent 176d948aae0a72dcc49a544effeed45712809efd
Author: Hugo Soucy <hugo.soucy@savoirfairelinux.com>
Date:   Thu, 29 Jun 2017 10:42:21 -0400

Preprocess js files.

Diffstat:
Mstatic/prod/js/script.js | 32+-------------------------------
Mstatic/prod/js/script.min.js | 2--
2 files changed, 1 insertion(+), 33 deletions(-)

diff --git a/static/prod/js/script.js b/static/prod/js/script.js @@ -408,7 +408,7 @@ function setNavigation() { $nav_panel.insertAdjacentHTML( 'beforeend', document.querySelector('#navCloseTpl').innerHTML ); - + $nav_button = document.querySelector('.nav-button'); $nav_close = $nav_panel.querySelector('.nav__close'); @@ -430,34 +430,4 @@ function setNavigation() { } } -function setHashtagSearch() { - var hashTags = du.queryAll('a.p-category'); - - hashTags.forEach(function(tag) { - du.setEvent(tag, 'click', function(thatEvt) { - thatEvt.preventDefault(); - - console.log(tag.innerHTML); - - document.forms['search'].elements['q'].value = tag.innerHTML; - document.forms['search'].submit(); - }); - }); -} - -function setClickableHashtags(fn) { - var hEntries = du.queryAll('.hentry'); - - hEntries.map(function(hEntry) { - var hEntryHashTagged = hEntry.innerHTML.replace( - /(^|\s)(#[a-zA-ZÀ-ú\d-]+)/ig, '$1<a class="p-category" href="$2" title="Chercher sur DuckDuckGo d\'autres entrées avec le tag $2">$2</a>' - ); - - hEntry.innerHTML = hEntryHashTagged; - }); - - fn(); -} - setNavigation(); -// setClickableHashtags(setHashtagSearch); diff --git a/static/prod/js/script.min.js b/static/prod/js/script.min.js @@ -29,6 +29,4 @@ function triggerCustomEvent(el,eventType,eventData){var customEvent;if(window.Cu el.dispatchEvent(customEvent);} function isElementInViewport(el){var elRect=el.getBoundingClientRect();return(elRect.top>=0&&elRect.left>=0&&elRect.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&elRect.right<=(window.innerWidth||document.documentElement.clientWidth));} return{doExtend:doExtend,queryAll:queryAll,setAttrs:setAttrs,setEvent:setEvent,setEventList:setEventList,getIndex:getIndex,getClosest:getClosest,getHeight:getHeight,setClass:setClass,unsetClass:unsetClass,hasClass:hasClass,toggleClass:toggleClass,setDebounce:setDebounce,setThrottle:setThrottle,isElement:isElement,isObject:isObject,triggerEvent:triggerEvent,triggerCustomEvent:triggerCustomEvent,isElementInViewport:isElementInViewport};})(window);function setNavigation(){'use strict';var $nav=document.querySelector('.nav');var visible='state--visible';var hidden='state--hidden';var $nav_panel;var $nav_button;var $nav_close;if(du.isElement($nav)){$nav_panel=$nav.querySelector('.nav__panel');document.body.insertAdjacentHTML('afterbegin',document.querySelector('#navButtonTpl').innerHTML);$nav_panel.insertAdjacentHTML('beforeend',document.querySelector('#navCloseTpl').innerHTML);$nav_button=document.querySelector('.nav-button');$nav_close=$nav_panel.querySelector('.nav__close');du.setClass($nav_panel,hidden);du.setEvent($nav_button,'click',function(thatEvt){thatEvt.preventDefault();du.toggleClass($nav_panel,hidden);du.toggleClass($nav_panel,visible);});du.setEvent($nav_close,'click',function(thatEvt){thatEvt.preventDefault();du.toggleClass($nav_panel,hidden);du.toggleClass($nav_panel,visible);});}} -function setHashtagSearch(){var hashTags=du.queryAll('a.p-category');hashTags.forEach(function(tag){du.setEvent(tag,'click',function(thatEvt){thatEvt.preventDefault();console.log(tag.innerHTML);document.forms['search'].elements['q'].value=tag.innerHTML;document.forms['search'].submit();});});} -function setClickableHashtags(fn){var hEntries=du.queryAll('.hentry');hEntries.map(function(hEntry){var hEntryHashTagged=hEntry.innerHTML.replace(/(^|\s)(#[a-zA-ZÀ-ú\d-]+)/ig,'$1<a class="p-category" href="$2" title="Chercher sur DuckDuckGo d\'autres entrées avec le tag $2">$2</a>');hEntry.innerHTML=hEntryHashTagged;});fn();} setNavigation(); \ No newline at end of file