npm, Gulp, Minimize
Resolves T30, T29
This commit is contained in:
parent
bc694dc6a0
commit
474efd25f3
16 changed files with 124 additions and 1091 deletions
115
res/js/app.js
115
res/js/app.js
|
@ -1,114 +1 @@
|
|||
/*
|
||||
* Rangitaki Project
|
||||
*
|
||||
* The MIT License
|
||||
*
|
||||
* Copyright 2015 mmk2410.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
var main = function () { // main function; called below
|
||||
|
||||
var fabActive = false; // fab hidden at begin
|
||||
$('.fabmenu').click( // action on fab click
|
||||
function () {
|
||||
if (!(fabActive)) { // if fab is hidden
|
||||
fabFadeIn(); // fade fab in
|
||||
fabActive = true; // fab = active
|
||||
} else { // if fab is shown
|
||||
fabFadeOut(); // fade fab out
|
||||
fabActive = false; // fab = hidden
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
var navOpen = false; // nav hidden at begin
|
||||
$('.nav-img, .overlay, .nav-close').click( // action on hamburger click
|
||||
function () {
|
||||
if (!(navOpen)) { // if nav is hidden
|
||||
openNav(); // open the nav drawer
|
||||
navOpen = true; // nav = open
|
||||
} else { // if nav is closed
|
||||
closeNav(); // close the nav drawer
|
||||
navOpen = false; // nav = closed
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
/**
|
||||
* Keyhandling for the navigation drawer.
|
||||
* opens the drawer on 'm' (key code: 77)
|
||||
* closes the drawer on 'Esc' (key code: 27)
|
||||
*/
|
||||
$(document).keyup(function (e) {
|
||||
if (navOpen && (e.which === 27)) {
|
||||
closeNav();
|
||||
navOpen = false;
|
||||
} else if (!(navOpen) && (e.which === 77)) {
|
||||
openNav();
|
||||
navOpen = true;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
$('.articletext a').attr('target', '_blank');
|
||||
|
||||
};
|
||||
|
||||
$(document).ready(main); // run if document is loaded
|
||||
|
||||
function goBack() { // go back function
|
||||
history.go(-1);
|
||||
}
|
||||
|
||||
function fabFadeIn() { // fade fab in
|
||||
$('.subfab').fadeIn(125); // fade subfabs in
|
||||
$('.fab-img').fadeOut( // fade fab share image out
|
||||
60, function callback() {
|
||||
$('.fab-img').attr("src", "./res/img/close.svg"); // change to fab close image
|
||||
}
|
||||
);
|
||||
$('.fab-img').fadeIn(60); // fade fab close image in
|
||||
}
|
||||
|
||||
function fabFadeOut() { // fade fab out
|
||||
$('.subfab').fadeOut(125); // fade subfabs out
|
||||
$('.fab-img').fadeOut( // fade fab close image out
|
||||
60, function callback() {
|
||||
$('.fab-img').attr("src", "./res/img/share.svg"); // change to fab share image
|
||||
}
|
||||
);
|
||||
$('.fab-img').fadeIn(60); // fade fab share image in
|
||||
}
|
||||
|
||||
function openNav() { // fade navigation drawer in
|
||||
$('.nav').animate({"left": "0px"}, 125); // slide in
|
||||
$('.overlay').show(); // set overlay to show ...
|
||||
$('.overlay').animate({"opacity": "0.4"}, 125); // ... and fade to a darker transparent color
|
||||
}
|
||||
|
||||
function closeNav() { // fade navigation drawer out
|
||||
$('.nav').animate({"left": "-301px"}, 125); // slide out
|
||||
$('.overlay').animate(
|
||||
{"opacity": "0.0"}, 125, function () { // fade the overlay to complete transparency
|
||||
$('.overlay').hide(); // hide it then
|
||||
}
|
||||
);
|
||||
}
|
||||
(function(){var n,t,a,e,r,i;r=function(){var e,r;return e=!1,$(".fabmenu").click(function(){return e?(a(),e=!1):(t(),e=!0)}),r=!1,$(".nav-img, .overlay, .nav-close").click(function(){return r?(n(),r=!1):(i(),r=!0)}),$(document).keyup(function(t){return r&&27===t.which?(n(),r=!1):r||77!==t.which?void 0:(i(),r=!0)}),$(".articletext a").attr("target","_blank")},$(document).ready(r),e=function(){return history.go(-1)},t=function(){return $(".subfab").fadeIn(125),$(".fab-img").fadeOut(60,function(){return $(".fab-img").attr("src","./res/img/close.svg"),$(".fab-img").fadeIn(60)})},a=function(){return $(".subfab").fadeOut(125),$(".fab-img").fadeOut(60,function(){return $(".fab-img").attr("src","./res/img/share.svg"),$(".fab-img").fadeIn(60)})},i=function(){return $(".nav").animate({left:"0px"},125),$(".overlay").show(),$(".overlay").animate({opacity:"0.4"},125)},n=function(){return $(".nav").animate({left:"-301px"},125),$(".overlay").animate({opacity:"0.0"},125,function(){return $(".overlay").hide})}}).call(this);
|
Reference in a new issue