From: Agnibho Mondal Date: Sun, 27 Nov 2016 14:56:38 +0000 (+0530) Subject: Major upgrade X-Git-Url: https://code.agnibho.com/repo?a=commitdiff_plain;h=a005447da4072749c10e9023267b740229dea673;p=obscalc.git Major upgrade --- diff --git a/index.html b/index.html index 2b9f21c..826168b 100755 --- a/index.html +++ b/index.html @@ -29,6 +29,7 @@ ObsCalc + diff --git a/src/main.js b/src/main.js index 050f3e8..b91310b 100644 --- a/src/main.js +++ b/src/main.js @@ -41,13 +41,29 @@ import "bootstrap-validator"; import Vue from "vue"; import ByDate from "./ByDate.vue"; import ByUsg from "./ByUsg.vue"; +import Settings from "./Settings.vue"; //Start app new Vue({ el: "#app", components: { "by-date": ByDate, - "by-usg": ByUsg + "by-usg": ByUsg, + "settings-btn": Settings + }, + data: {settings: ""}, + mounted:function(){ + try{ + this.settings=JSON.parse(localStorage.getItem("settings")); + } + finally{ + if(this.settings==null){ + this.settings={dstyle:"cal"}; + } + else if(this.settings.dstyle!="cal" && this.settings.dstyle!="txt"){ + this.settings={dstyle:"cal"}; + } + } } }); diff --git a/src/routine.js b/src/routine.js index c86f72a..08c9d75 100644 --- a/src/routine.js +++ b/src/routine.js @@ -30,9 +30,14 @@ $(document).ready(function(){ $(".container").fadeIn(); //Update copyright - if(new Date().getFullYear()>2016){ - $("#copyright").text("-"+new Date().getFullYear()); - } + $(".copyright").each(function(){ + if(new Date().getFullYear()>$(this).data("start")){ + $(this).text($(this).data("start")+"-"+new Date().getFullYear()); + } + else{ + $(this).text(new Date().getFullYear()); + } + }); //Emit input on form reset $("input[type='reset']").on("click", function(e){ @@ -52,4 +57,24 @@ $(document).ready(function(){ }); } + //Change focus after number input + $(".jump-focus").on("input", function(){ + if($(this).val().length == $(this).prop("maxlength")){ + var all=$("input").toArray(); + var i=all.indexOf(this)+1; + $(all[i]).focus().select(); + } + }); + + //Defocus after input finished + $(".stop-focus").on("input", function(){ + if($(this).val().length == $(this).prop("maxlength")){ + $(this).blur(); + var target=$($(this).data("ref")); + console.log($(target).offset()); + $("html, body").animate({ + scrollTop: $(target).offset().top + }, 1000); + } + }); }); diff --git a/webpack.config.js b/webpack.config.js index 69fe720..d87f3b8 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -4,8 +4,8 @@ var path = require('path') module.exports = { entry: './src/main.js', output: { - path: path.resolve(__dirname, './dist'), - publicPath: '/dist/', + path: path.resolve(__dirname, 'dist'), + publicPath: 'dist/', filename: 'bundle.js' }, module: {