Merge banner.js into Rake task

Also let uglify-js produce source map for easier debugging
This commit is contained in:
iBug committed 2024-05-05 04:13:39 +08:00
1 parent 0b8b5230f9
commit b278dac7fb
3 files changed
+4 -11

No files matched your search

+3 -3
View File
@@ -155,9 +155,9 @@ CLEAN.include(*COPYRIGHT_FILES)
JS_FILES = Dir.glob("assets/js/plugins/*.js") + ["assets/js/_main.js"]
JS_TARGET = "assets/js/main.min.js"
task :js => JS_TARGET
file JS_TARGET => JS_FILES do |t|
sh Shellwords.join(%w[npx uglifyjs -c -m -o] + [t.name] + t.prerequisites)
sh "node banner.js"
file JS_TARGET => ["_includes/copyright.js"] + JS_FILES do |t|
sh Shellwords.join(%w[npx uglifyjs -c --comments /@mmistakes/ --source-map -m -o] +
[t.name] + t.prerequisites)
end
task :watch_js do
+1
View File
@@ -0,0 +1 @@
{"version":3,"sources":["assets/js/plugins/gumshoe.js","assets/js/plugins/jquery.ba-throttle-debounce.js","assets/js/plugins/jquery.fitvids.js","assets/js/plugins/jquery.greedy-navigation.js","assets/js/plugins/jquery.magnific-popup.js","assets/js/plugins/smooth-scroll.js","assets/js/_main.js"],"names":["root","factory","define","amd","exports","module","Gumshoe","global","window","this","sortContents","contents","sort","item1","item2","getOffsetTop","content","isAtBottom","innerHeight","pageYOffset","Math","max","document","body","scrollHeight","documentElement","offsetHeight","clientHeight","deactivate","items","settings","li","nav","closest","classList","remove","navClass","contentClass","deactivateNested","emitEvent","link","defaults","nested","nestedClass","offset","reflow","events","type","elem","detail","event","CustomEvent","bubbles","cancelable","dispatchEvent","location","offsetParent","offsetTop","isInView","bottom","bounds","getBoundingClientRect","parseFloat","parseInt","top","useLastItem","item","parentNode","activateNested","add","selector","options","scrollHandler","timeout","cancelAnimationFrame","requestAnimationFrame","publicAPIs","detect","resizeHandler","navItems","current","setup","querySelectorAll","Array","prototype","forEach","call","getElementById","decodeURIComponent","hash","substr","push","active","last","length","i","destroy","removeEventListener","merged","arguments","obj","key","hasOwnProperty","addEventListener","undefined","jq_throttle","$","jQuery","Cowboy","throttle","delay","no_trailing","callback","debounce_mode","timeout_id","last_exec","wrapper","that","elapsed","Date","args","exec","apply","clearTimeout","setTimeout","guid","debounce","at_begin","fn","fitVids","head","div","customSelector","ignore","getElementsByTagName","createElement","innerHTML","appendChild","childNodes","extend","each","selectors","ignoreList","$allVideos","find","join","not","count","aspectRatio","$this","parents","tagName","toLowerCase","parent","css","isNaN","attr","height","width","wrap","removeAttr","Zepto","numOfItems","totalSpace","closingTime","breakWidths","$btn","$vlinks","$hlinks","$nav","$logo","$logoImg","$title","$search","measureLinks","addWidth","w","children","outerWidth","clone","append","availableSpace","numOfVisibleItems","requiredSpace","timer","winWidth","lastBreakpoint","check","curBreakpoint","innerWidth","prependTo","first","appendTo","addClass","removeClass","resize","on","toggleClass","complete","naturalWidth","one","require","MagnificPopup","_mfpOn","name","f","mfp","ev","EVENT_NS","_getEl","className","html","raw","el","_mfpTrigger","e","data","triggerHandler","st","callbacks","charAt","slice","isArray","_getCloseBtn","_currPopupType","currTemplate","closeBtn","closeMarkup","replace","tClose","_checkInstance","magnificPopup","instance","init","_putInlineElementsBack","_lastInlineElement","_inlinePlaceholder","after","_hiddenClass","detach","_removeAjaxCursor","_ajaxCur","_destroyAjaxRequest","req","abort","_prevStatus","_document","_prevContentType","_wrapClasses","CLOSE_EVENT","BEFORE_CLOSE_EVENT","MARKUP_PARSE_EVENT","OPEN_EVENT","READY_CLASS","REMOVING_CLASS","PREVENT_CLOSE_CLASS","_isJQ","_window","INLINE_NS","proto","constructor","appVersion","navigator","isLowIE","isIE8","all","isAndroid","test","isIOS","supportsTransition","s","style","v","pop","probablyMobile","userAgent","popupsCache","open","isObj","toArray","index","parsed","isOpen","types","mainEl","eq","fixedContentPos","modal","closeOnContentClick","closeOnBgClick","showCloseBtn","enableEscapeKey","bgOverlay","close","_checkIfClose","target","container","contentContainer","preloader","tLoading","modules","n","toUpperCase","closeBtnInside","template","values","close_replaceWith","alignTop","overflow","overflowY","overflowX","scrollTop","position","fixedBgPos","keyCode","updateSize","windowHeight","wH","windowStyles","classesToadd","_hasScrollBar","_getScrollbarSize","marginRight","isIE7","mainClass","_addClassToMFP","updateItemHTML","_lastFocusedEl","activeElement","_setFocus","_onFocusIn","removalDelay","_close","classesToRemove","empty","_removeClassFromMFP","off","currItem","autoFocusLast","focus","prevHeight","winHeight","zoomLevel","clientWidth","parseEl","newContent","markup","appendContent","preloaded","prepend","src","hasClass","addGroup","eHandler","mfpEl","_openClick","eName","delegate","midClick","which","ctrlKey","metaKey","altKey","shiftKey","disableOn","isFunction","preventDefault","stopPropagation","updateStatus","status","text","stopImmediatePropagation","closeOnContent","closeOnBg","contains","cName","_parseMarkup","arr","value","split","replaceWith","is","scrollDiv","scrollbarSize","cssText","offsetWidth","removeChild","registerModule","itemOpts","jqEl","AJAX_NS","hiddenClass","tNotFound","initInline","getInline","inlineSt","inline","inlineElement","cursor","tError","initAjax","ajax","getAjax","opts","url","success","textStatus","jqXHR","temp","xhr","finished","error","loadError","_imgLine truncated
-8
View File
@@ -1,8 +0,0 @@
const fs = require("fs");
const filename = "assets/js/main.min.js"
const script = fs.readFileSync(filename);
const banner = fs.readFileSync("_includes/copyright.js");
if (script.slice(0, 3) != "/*!") {
fs.writeFileSync(filename, banner + script);
}