From 72294eee220c7583e2b65535108412f740c2cf32 Mon Sep 17 00:00:00 2001 From: Richard Ruiter Date: Thu, 10 Apr 2014 09:10:37 +0000 Subject: [PATCH 1/4] worked on #1 basic setup for authentication and local/session storage --- .gitmodules | 5 +- Gruntfile.js | 6 + bower.json | 3 +- dist/alterne.html | 2 + dist/assets/js/main.js | 49 ++ dist/assets/js/main.min.js | 2 +- .../lib/jquery-storage-api/CHANGELOG.txt | 47 ++ dist/assets/lib/jquery-storage-api/README.md | 187 ++++++++ dist/assets/lib/jquery-storage-api/bower.json | 41 ++ .../jquery-storage-api/jquery.storageapi.js | 424 ++++++++++++++++++ .../jquery.storageapi.min.js | 2 + .../jquery-storage-api/storageapi.jquery.json | 35 ++ dist/assets/lib/jquery.storageapi.min.js | 2 + dist/bgcolor.html | 2 + dist/bgimage.html | 2 + dist/blank.html | 2 + dist/button.html | 2 + dist/calendar.html | 2 + dist/chart.html | 2 + dist/dashboard.html | 2 + dist/file.html | 2 + dist/form-general.html | 2 + dist/form-validation.html | 2 + dist/form-wizard.html | 2 + dist/form-wysiwyg.html | 2 + dist/grid.html | 2 + dist/icon.html | 2 + dist/index.html | 2 + dist/interstitials.html | 2 + dist/login.html | 18 +- dist/maps.html | 2 + dist/panel.html | 2 + dist/pricing.html | 2 + dist/progress.html | 2 + dist/push.html | 2 + dist/table.html | 2 + src/assets/js/app/auth.js | 48 ++ src/assets/lib/jquery-storage-api | 1 + src/templates/layouts/default.hbs | 2 + src/templates/layouts/login.hbs | 11 + src/templates/login/login.hbs | 8 +- 41 files changed, 926 insertions(+), 11 deletions(-) create mode 100644 dist/assets/lib/jquery-storage-api/CHANGELOG.txt create mode 100644 dist/assets/lib/jquery-storage-api/README.md create mode 100644 dist/assets/lib/jquery-storage-api/bower.json create mode 100644 dist/assets/lib/jquery-storage-api/jquery.storageapi.js create mode 100644 dist/assets/lib/jquery-storage-api/jquery.storageapi.min.js create mode 100644 dist/assets/lib/jquery-storage-api/storageapi.jquery.json create mode 100644 dist/assets/lib/jquery.storageapi.min.js create mode 100644 src/assets/js/app/auth.js create mode 160000 src/assets/lib/jquery-storage-api diff --git a/.gitmodules b/.gitmodules index 7c1975c..c0f7a26 100644 --- a/.gitmodules +++ b/.gitmodules @@ -63,4 +63,7 @@ url = https://github.com/xoxco/jQuery-Tags-Input.git [submodule "src/assets/submodule/validVal"] path = src/assets/submodule/validVal - url = https://github.com/BeSite/jQuery.validVal.git \ No newline at end of file + url = https://github.com/BeSite/jQuery.validVal.git +[submodule "src/assets/lib/jquery-storage-api"] + path = src/assets/lib/jquery-storage-api + url = git@github.com:julien-maurel/jQuery-Storage-API.git diff --git a/Gruntfile.js b/Gruntfile.js index 1b5dd8e..1e99f1e 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -169,6 +169,12 @@ module.exports = function (grunt) { src: ['./**/jquery*.min.*'], dest: 'dist/assets/lib' }, + { + expand: true, + cwd: 'bower_components/jQuery-Storage-API/', + src: ['./**/jquery.storageapi.min.js'], + dest: 'dist/assets/lib' + }, { expand: true, cwd: 'bower_components/bootstrap/dist/', diff --git a/bower.json b/bower.json index b114c6e..898e147 100644 --- a/bower.json +++ b/bower.json @@ -24,6 +24,7 @@ "font-awesome": "~4.0.3", "gmaps": "~0.4.9", "html5shiv": "~3.7.0", - "respond": "~1.4.0" + "respond": "~1.4.0", + "jQuery-Storage-API": "git@github.com:julien-maurel/jQuery-Storage-API.git" } } diff --git a/dist/alterne.html b/dist/alterne.html index 6f90dcf..fcd5aa3 100644 --- a/dist/alterne.html +++ b/dist/alterne.html @@ -471,6 +471,8 @@ dashboard(); }); + + diff --git a/dist/assets/js/main.js b/dist/assets/js/main.js index a5860da..9642808 100644 --- a/dist/assets/js/main.js +++ b/dist/assets/js/main.js @@ -4,6 +4,55 @@ * Copyright 2014 * Licensed under MIT */ +$(function () { + "use strict"; + + // define storages + var ns = $.initNamespaceStorage('auth'), + local = ns.localStorage, + session = ns.sessionStorage; + + // submitted? + var submitkeys = ['submit_key','submit_secret','submit_dir']; + if (session.isSet(submitkeys)) { + + // check AWS + AWS.config.region = 'eu-west-1'; + AWS.config.update({ + accessKeyId: session.get('submit_key'), + secretAccessKey: session.get('submit_secret') + }); + var s3 = new AWS.S3({params: {Bucket: 'librelio-europe'}}); + s3.listObjects(function(error,data) { + if (error === null) { + console.log(data); + } else { + console.log(error); + } + }) + + // clear submitted data + //session.remove(submitkeys); + } + + // check authentication + var storage = (local.get('remember') === true) ? local : session; + if (!storage.isSet(['key','secret','dir'])) { + //location.href = 'login.html'; + + } + /* + var key = storage.get('key'), + secret = storage.get('secret'), + dir = storage.get('dir'); + + if () + */ + + //ns.localStorage.set('remember', true); +}); + + $(function () { "use strict"; diff --git a/dist/assets/js/main.min.js b/dist/assets/js/main.min.js index 2975e3f..a281116 100644 --- a/dist/assets/js/main.min.js +++ b/dist/assets/js/main.min.js @@ -4,4 +4,4 @@ * Copyright 2014 * Licensed under MIT */ -function metisButton(){window.prettyPrint&&prettyPrint(),$.each($(".inner a.btn"),function(){$(this).popover({placement:"bottom",title:this.innerHTML,content:this.outerHTML,trigger:"hover"})})}function metisChart(){"use strict";function a(a){return Math.sqrt(2)*Math.cos(a)/(Math.pow(Math.sin(a),2)+1)}function b(a){return Math.sqrt(2)*Math.cos(a)*Math.sin(a)/(Math.pow(Math.sin(a),2)+1)}var c=[[0,3],[1,8],[2,5],[3,13],[4,1]],d=[[0,12],[2,2],[3,9],[4,4]];$.plot($("#trigo"),[{data:c,label:"MAN"},{data:d,label:"WOMAN"}],{clickable:!0,hoverable:!0,series:{lines:{show:!0,fill:!0,fillColor:{colors:[{opacity:.5},{opacity:.15}]}},points:{show:!0}}}),$.plot($("#trigo2"),[{data:c,label:"BAR"}],{clickable:!0,hoverable:!0,series:{bars:{show:!0,barWidth:.6},points:{show:!0}}});for(var e=[],f=[],g=-5;5>=g;g+=.5)e.push([g,Math.pow(g,2)-25]),f.push([g,-Math.pow(g,2)+25]);for(var h=[],i=-2;2.1>=i;i+=.1)h.push([i,Math.sqrt(400-i*i*100)]),h.push([i,-Math.sqrt(400-i*i*100)]);$.plot($("#eye"),[{data:f,lines:{show:!0,fill:!0}},{data:e,lines:{show:!0,fill:!0}},{data:h,lines:{show:!0}}]);var j=[];for(g=-2;5>=g;g+=.01)j.push([16*Math.pow(Math.sin(g),3),13*Math.cos(g)-5*Math.cos(2*g)-2*Math.cos(3*g)-Math.cos(4*g)]);$.plot($("#heart"),[{data:j,label:'',color:"#9A004D"}],{series:{lines:{show:!0,fill:!0},points:{show:!1}},yaxis:{show:!0},xaxis:{show:!0}}),$("#heart .legendLabel").addClass("animated pulse"),setInterval(function(){$("#heart .legendLabel .fa.fa-heart").toggleClass("fa-2x")},400);for(var k=[],l=0;l<=2*Math.PI;l+=.01)k.push([a(l),b(l)]);$.plot($("#bernoilli"),[{data:k,label:"Lemniscate of Bernoulli",lines:{show:!0,fill:!0}}])}function dashboard(){"use strict";function a(a,b,c){$('
'+c+"
").css({position:"absolute",display:"none",top:b+5,left:a+5,border:"1px solid #fdd",padding:"2px","background-color":"#000",color:"#fff"}).appendTo("body").fadeIn(200)}$(".inlinesparkline").sparkline();var b=[10,8,5,7,4,4,1];$(".dynamicsparkline").sparkline(b),$(".dynamicbar").sparkline(b,{type:"bar",barColor:"green"}),$(".inlinebar").sparkline("html",{type:"bar",barColor:"red"}),$(".sparkline.bar_week").sparkline([5,6,7,2,0,-4,-2,4],{type:"bar",height:"40",barWidth:5,barColor:"#4d6189",negBarColor:"#a20051"}),$(".sparkline.line_day").sparkline([5,6,7,9,9,5,4,6,6,4,6,7],{type:"line",height:"40",drawNormalOnTop:!1}),$(".sparkline.pie_week").sparkline([1,1,2],{type:"pie",width:"40",height:"40"}),$(".sparkline.stacked_month").sparkline(["0:2","2:4","4:2","4:1"],{type:"bar",height:"40",barWidth:10,barColor:"#4d6189",negBarColor:"#a20051"});for(var c=new Date,d=c.getDate(),e=c.getMonth(),f=c.getFullYear(),g=$("#calendar").fullCalendar({header:{left:"prev,today,next,",center:"title",right:"month,agendaWeek,agendaDay"},selectable:!0,selectHelper:!0,select:function(a,b,c){var d=prompt("Event Title:");d&&g.fullCalendar("renderEvent",{title:d,start:a,end:b,allDay:c},!0),g.fullCalendar("unselect")},editable:!0,events:[{title:"All Day Event",start:new Date(f,e,1),className:"label label-success"},{title:"Long Event",start:new Date(f,e,d-5),end:new Date(f,e,d-2),className:"label label-info"},{id:999,title:"Repeating Event",start:new Date(f,e,d-3,16,0),allDay:!1,className:"label label-warning"},{id:999,title:"Repeating Event",start:new Date(f,e,d+4,16,0),allDay:!1,className:"label label-inverse"},{title:"Meeting",start:new Date(f,e,d,10,30),allDay:!1,className:"label label-important"},{title:"Lunch",start:new Date(f,e,d,12,0),end:new Date(f,e,d,14,0),allDay:!1},{title:"Birthday Party",start:new Date(f,e,d+1,19,0),end:new Date(f,e,d+1,22,30),allDay:!1},{title:"Click for Google",start:new Date(f,e,28),end:new Date(f,e,29),url:"http://google.com/"}]}),h=[],i=[],j=0;14>j;j+=.5)h.push([j,Math.sin(j)]),i.push([j,Math.cos(j)]);var k=($.plot($("#trigo"),[{data:h,label:"sin(x)",points:{fillColor:"#4572A7",size:5},color:"#4572A7"},{data:i,label:"cos(x)",points:{fillColor:"#333",size:35},color:"#AA4643"}],{series:{lines:{show:!0},points:{show:!0}},grid:{hoverable:!0,clickable:!0},yaxis:{min:-1.2,max:1.2}}),null);$("#trigo").bind("plothover",function(b,c,d){if($("#x").text(c.x.toFixed(2)),$("#y").text(c.y.toFixed(2)),d){if(k!==d.dataIndex){k=d.dataIndex,$("#tooltip").remove();var e=d.datapoint[0].toFixed(2),f=d.datapoint[1].toFixed(2);a(d.pageX,d.pageY,d.series.label+" of "+e+" = "+f)}}else $("#tooltip").remove(),k=null}),$(".sortableTable").tablesorter()}function formGeneral(){"use strict";$(".with-tooltip").tooltip({selector:".input-tooltip"}),$("#autosize").autosize(),$("#limiter").inputlimiter({limit:140,remText:"You only have %n character%s remaining...",limitText:"You're allowed to input %n character%s into this field."}),$("#tags").tagsInput(),$(".chzn-select").chosen(),$(".chzn-select-deselect").chosen({allow_single_deselect:!0}),$(".uniform").uniform(),$("#validVal").validVal(),$("#cp1").colorpicker({format:"hex"}),$("#cp2").colorpicker(),$("#cp3").colorpicker(),$("#cp4").colorpicker().on("changeColor",function(a){$("#colorPickerBlock").css("background-color",a.color.toHex())}),$("#dp1").datepicker({format:"mm-dd-yyyy"}),$("#dp2").datepicker(),$("#dp3").datepicker(),$("#dp3").datepicker(),$("#dpYears").datepicker(),$("#dpMonths").datepicker();var a=new Date(2014,1,20),b=new Date(2014,1,25);$("#dp4").datepicker().on("changeDate",function(c){c.date.valueOf()>b.valueOf()?$("#alert").show().find("strong").text("The start date can not be greater then the end date"):($("#alert").hide(),a=new Date(c.date),$("#startDate").text($("#dp4").data("date"))),$("#dp4").datepicker("hide")}),$("#dp5").datepicker().on("changeDate",function(c){c.date.valueOf()'+a+"");jQuery("#external-events").append(d),c(d)};$("#external-events li.external-event").each(function(){c($(this))}),$("#add-event").click(function(){var a=$("#title").val(),b=$("input:radio[name=priority]:checked").val();d(a,b)}),$("#calendar").fullCalendar({header:b,buttonText:{prev:'',next:''},editable:!0,droppable:!0,drop:function(a,b){var c=$(this).data("eventObject"),d=$.extend({},c);d.start=a,d.allDay=b,$("#calendar").fullCalendar("renderEvent",d,!0),$("#drop-remove").is(":checked")&&$(this).remove()},windowResize:function(){$("#calendar").fullCalendar("render")}})}function metisFile(){"use strict";$("#elfinder").elfinder({url:"assets/elfinder-2.0-rc1/php/connector.php"}).elfinder("instance")}function metisMaps(){"use strict";var a,b,c,d,e,f,g;a=new GMaps({el:"#gmaps-basic",lat:-12.043333,lng:-77.028333,zoomControl:!0,zoomControlOpt:{style:"SMALL",position:"TOP_LEFT"},panControl:!1,streetViewControl:!1,mapTypeControl:!1,overviewMapControl:!1}),b=new GMaps({el:"#gmaps-marker",lat:-12.043333,lng:-77.028333}),b.addMarker({lat:-12.043333,lng:-77.03,title:"Lima",details:{database_id:42,author:"HPNeo"},click:function(a){console.log&&console.log(a),alert("You clicked in this marker")},mouseover:function(a){console.log&&console.log(a)}}),b.addMarker({lat:-12.042,lng:-77.028333,title:"Marker with InfoWindow",infoWindow:{content:"

HTML Content

"}}),c=new GMaps({el:"#gmaps-geolocation",lat:-12.043333,lng:-77.028333}),GMaps.geolocate({success:function(a){c.setCenter(a.coords.latitude,a.coords.longitude)},error:function(a){alert("Geolocation failed: "+a.message)},not_supported:function(){alert("Your browser does not support geolocation")},always:function(){}}),d=new GMaps({el:"#gmaps-polylines",lat:-12.043333,lng:-77.028333,click:function(a){console.log(a)}}),f=[[-12.044012922866312,-77.02470665341184],[-12.05449279282314,-77.03024273281858],[-12.055122327623378,-77.03039293652341],[-12.075917129727586,-77.02764635449216],[-12.07635776902266,-77.02792530422971],[-12.076819390363665,-77.02893381481931],[-12.088527520066453,-77.0241058385925],[-12.090814532191756,-77.02271108990476]],d.drawPolyline({path:f,strokeColor:"#131540",strokeOpacity:.6,strokeWeight:6}),e=new GMaps({el:"#gmaps-route",lat:-12.043333,lng:-77.028333}),e.drawRoute({origin:[-12.044012922866312,-77.02470665341184],destination:[-12.090814532191756,-77.02271108990476],travelMode:"driving",strokeColor:"#131540",strokeOpacity:.6,strokeWeight:6}),g=new GMaps({el:"#gmaps-geocoding",lat:-12.043333,lng:-77.028333}),$("#geocoding_form").submit(function(a){a.preventDefault(),GMaps.geocode({address:$("#address").val().trim(),callback:function(a,b){if("OK"===b){var c=a[0].geometry.location;g.setCenter(c.lat(),c.lng()),g.addMarker({lat:c.lat(),lng:c.lng()})}}})})}function metisSortable(){$(".inner .row").sortable({})}function metisTable(){"use strict";$(".sortableTable").tablesorter(),$("#dataTable").dataTable({sDom:"<'pull-right'l>t<'row'<'col-lg-6'f><'col-lg-6'p>>",sPaginationType:"bootstrap",oLanguage:{sLengthMenu:"Show _MENU_ entries"}}),$("#actionTable button.remove").on("click",function(){$(this).closest("tr").remove()}),$("#actionTable button.edit").on("click",function(){$("#editModal").modal({show:!0});var a=$(this).closest("tr").children("td").eq(1),b=$(this).closest("tr").children("td").eq(2),c=$(this).closest("tr").children("td").eq(3);$("#editModal #fName").val(a.html()),$("#editModal #lName").val(b.html()),$("#editModal #uName").val(c.html()),$("#editModal #sbmtBtn").on("click",function(){a.html($("#editModal #fName").val()),b.html($("#editModal #lName").val()),c.html($("#editModal #uName").val())})})}function metisPricing(){$("#dark-toggle label").on("click",function(){var a=$(this);$("ul.dark li.active").removeClass("primary success danger warning info default").addClass(a.find("input").val())}),$("#light-toggle label").on("click",function(){var a=$(this);$("ul#light li.active").removeClass("primary success danger warning info default").addClass(a.find("input").val())})}function progRess(){window.prettyPrint&&prettyPrint(),$.each($(".progress .progress-bar"),function(){$(this).animate({width:$(this).attr("aria-valuenow")+"%"}),$(this).popover({placement:"bottom",title:"Source",content:this.outerHTML})})}$(function(){"use strict";$("a[href=#]").on("click",function(a){a.preventDefault()}),$("a[data-toggle=tooltip]").tooltip(),$("a[data-tooltip=tooltip]").tooltip(),$(".minimize-box").on("click",function(a){a.preventDefault();var b=$(this).children("i");b.hasClass("icon-chevron-down")?b.removeClass("icon-chevron-down").addClass("icon-chevron-up"):b.hasClass("icon-chevron-up")&&b.removeClass("icon-chevron-up").addClass("icon-chevron-down")}),$(".close-box").click(function(){$(this).closest(".box").hide("slow")}),$("#changeSidebarPos").on("click",function(){$("body").toggleClass("hide-sidebar")}),$("li.accordion-group > a").on("click",function(){$(this).children("span").children("i").toggleClass("icon-angle-down")}),$("#menu-toggle").on("click",function(a){$("#left").toggleClass("opened"),a.preventDefault()}),$("#menu").metisMenu()});var toggleFullScreen={init:function(){void 0!==window.screenfull&&screenfull.enabled?$("#toggleFullScreen").on("click",function(a){screenfull.toggle(window.document[0]),$("body").toggleClass("fullScreen"),a.preventDefault()}):$("#toggleFullScreen").addClass("hidden")}};toggleFullScreen.init();var boxFullScreen={init:function(){void 0!==window.screenfull&&screenfull.enabled?$(".full-box").on("click",function(a){var b=$(this).parents(".box")[0];screenfull.toggle(b),$(this).parents(".box").toggleClass("full-screen-box"),$(this).parents(".box").children(".body").toggleClass("full-screen-box"),$(this).children("i").toggleClass("fa-compress"),a.preventDefault()}):$(".full-box").addClass("hidden")}};boxFullScreen.init();var panelBodyCollapse={init:function(){var a=$(".collapse-box"),b=a.closest(".box").children(".body");b.collapse("show"),a.on("click",function(a){var b=$(this).closest(".box").children(".body"),c=$(this).children("i");b.on("show.bs.collapse",function(){c.removeClass("fa-minus fa-plus").addClass("fa-spinner fa-spin")}),b.on("shown.bs.collapse",function(){c.removeClass("fa-spinner fa-spin").addClass("fa-minus")}),b.on("hide.bs.collapse",function(){c.removeClass("fa-minus fa-plus").addClass("fa-spinner fa-spin")}),b.on("hidden.bs.collapse",function(){c.removeClass("fa-spinner fa-spin").addClass("fa-plus")}),b.collapse("toggle"),a.preventDefault()})}};panelBodyCollapse.init();var boxHiding={init:function(){$(".close-box").click(function(){$(this).closest(".box").hide("slow")})}};boxHiding.init(),function(a,b){function c(b,c){this.element=b,this.settings=a.extend({},e,c),this._defaults=e,this._name=d,this.init()}var d="metisMenu",e={toggle:!0,hidingClass:"u-isHiddenVisually"};c.prototype={init:function(){function c(){a("body").removeClass("mini-sidebar"),g.find("li.active").has("ul").children("ul").addClass("collapse in"),g.find("li").not(".active").has("ul").children("ul").addClass("collapse"),g.find("li").has("ul").children("a").on("click",function(b){b.preventDefault(),a(this).parent("li").toggleClass("opened").children("ul").collapse("toggle"),h&&a(this).parent("li").siblings().removeClass("opened").children("ul.in").collapse("hide")})}function d(){g.find("li").has("ul").children("ul").removeClass("collapse in").css("height","inherit"),g.hasClass("affix")||g.find("li").has("ul").children("a").off("click")}function e(){a(b).width()<992?c():d()}{var f,g=a(this.element),h=this.settings.toggle;this.settings.hidingClass}e(),g.on("affix.bs.affix",function(){console.log("affix.bs.affix")}),g.on("affix-top.bs.affix",function(){console.log("affix-top.bs.affix")}),g.on("affixed.bs.affix",function(){c(),console.log("affixed.bs.affix")}),g.on("affixed-top.bs.affix",function(){d(),console.log("affixed-top.bs.affix")}),a(b).resize(function(){clearTimeout(f),f=setTimeout(e,250)})}},a.fn[d]=function(b){return this.each(function(){a.data(this,"plugin_"+d)||a.data(this,"plugin_"+d,new c(this,b))})}}(jQuery,window,document); \ No newline at end of file +function metisButton(){window.prettyPrint&&prettyPrint(),$.each($(".inner a.btn"),function(){$(this).popover({placement:"bottom",title:this.innerHTML,content:this.outerHTML,trigger:"hover"})})}function metisChart(){"use strict";function a(a){return Math.sqrt(2)*Math.cos(a)/(Math.pow(Math.sin(a),2)+1)}function b(a){return Math.sqrt(2)*Math.cos(a)*Math.sin(a)/(Math.pow(Math.sin(a),2)+1)}var c=[[0,3],[1,8],[2,5],[3,13],[4,1]],d=[[0,12],[2,2],[3,9],[4,4]];$.plot($("#trigo"),[{data:c,label:"MAN"},{data:d,label:"WOMAN"}],{clickable:!0,hoverable:!0,series:{lines:{show:!0,fill:!0,fillColor:{colors:[{opacity:.5},{opacity:.15}]}},points:{show:!0}}}),$.plot($("#trigo2"),[{data:c,label:"BAR"}],{clickable:!0,hoverable:!0,series:{bars:{show:!0,barWidth:.6},points:{show:!0}}});for(var e=[],f=[],g=-5;5>=g;g+=.5)e.push([g,Math.pow(g,2)-25]),f.push([g,-Math.pow(g,2)+25]);for(var h=[],i=-2;2.1>=i;i+=.1)h.push([i,Math.sqrt(400-i*i*100)]),h.push([i,-Math.sqrt(400-i*i*100)]);$.plot($("#eye"),[{data:f,lines:{show:!0,fill:!0}},{data:e,lines:{show:!0,fill:!0}},{data:h,lines:{show:!0}}]);var j=[];for(g=-2;5>=g;g+=.01)j.push([16*Math.pow(Math.sin(g),3),13*Math.cos(g)-5*Math.cos(2*g)-2*Math.cos(3*g)-Math.cos(4*g)]);$.plot($("#heart"),[{data:j,label:'',color:"#9A004D"}],{series:{lines:{show:!0,fill:!0},points:{show:!1}},yaxis:{show:!0},xaxis:{show:!0}}),$("#heart .legendLabel").addClass("animated pulse"),setInterval(function(){$("#heart .legendLabel .fa.fa-heart").toggleClass("fa-2x")},400);for(var k=[],l=0;l<=2*Math.PI;l+=.01)k.push([a(l),b(l)]);$.plot($("#bernoilli"),[{data:k,label:"Lemniscate of Bernoulli",lines:{show:!0,fill:!0}}])}function dashboard(){"use strict";function a(a,b,c){$('
'+c+"
").css({position:"absolute",display:"none",top:b+5,left:a+5,border:"1px solid #fdd",padding:"2px","background-color":"#000",color:"#fff"}).appendTo("body").fadeIn(200)}$(".inlinesparkline").sparkline();var b=[10,8,5,7,4,4,1];$(".dynamicsparkline").sparkline(b),$(".dynamicbar").sparkline(b,{type:"bar",barColor:"green"}),$(".inlinebar").sparkline("html",{type:"bar",barColor:"red"}),$(".sparkline.bar_week").sparkline([5,6,7,2,0,-4,-2,4],{type:"bar",height:"40",barWidth:5,barColor:"#4d6189",negBarColor:"#a20051"}),$(".sparkline.line_day").sparkline([5,6,7,9,9,5,4,6,6,4,6,7],{type:"line",height:"40",drawNormalOnTop:!1}),$(".sparkline.pie_week").sparkline([1,1,2],{type:"pie",width:"40",height:"40"}),$(".sparkline.stacked_month").sparkline(["0:2","2:4","4:2","4:1"],{type:"bar",height:"40",barWidth:10,barColor:"#4d6189",negBarColor:"#a20051"});for(var c=new Date,d=c.getDate(),e=c.getMonth(),f=c.getFullYear(),g=$("#calendar").fullCalendar({header:{left:"prev,today,next,",center:"title",right:"month,agendaWeek,agendaDay"},selectable:!0,selectHelper:!0,select:function(a,b,c){var d=prompt("Event Title:");d&&g.fullCalendar("renderEvent",{title:d,start:a,end:b,allDay:c},!0),g.fullCalendar("unselect")},editable:!0,events:[{title:"All Day Event",start:new Date(f,e,1),className:"label label-success"},{title:"Long Event",start:new Date(f,e,d-5),end:new Date(f,e,d-2),className:"label label-info"},{id:999,title:"Repeating Event",start:new Date(f,e,d-3,16,0),allDay:!1,className:"label label-warning"},{id:999,title:"Repeating Event",start:new Date(f,e,d+4,16,0),allDay:!1,className:"label label-inverse"},{title:"Meeting",start:new Date(f,e,d,10,30),allDay:!1,className:"label label-important"},{title:"Lunch",start:new Date(f,e,d,12,0),end:new Date(f,e,d,14,0),allDay:!1},{title:"Birthday Party",start:new Date(f,e,d+1,19,0),end:new Date(f,e,d+1,22,30),allDay:!1},{title:"Click for Google",start:new Date(f,e,28),end:new Date(f,e,29),url:"http://google.com/"}]}),h=[],i=[],j=0;14>j;j+=.5)h.push([j,Math.sin(j)]),i.push([j,Math.cos(j)]);var k=($.plot($("#trigo"),[{data:h,label:"sin(x)",points:{fillColor:"#4572A7",size:5},color:"#4572A7"},{data:i,label:"cos(x)",points:{fillColor:"#333",size:35},color:"#AA4643"}],{series:{lines:{show:!0},points:{show:!0}},grid:{hoverable:!0,clickable:!0},yaxis:{min:-1.2,max:1.2}}),null);$("#trigo").bind("plothover",function(b,c,d){if($("#x").text(c.x.toFixed(2)),$("#y").text(c.y.toFixed(2)),d){if(k!==d.dataIndex){k=d.dataIndex,$("#tooltip").remove();var e=d.datapoint[0].toFixed(2),f=d.datapoint[1].toFixed(2);a(d.pageX,d.pageY,d.series.label+" of "+e+" = "+f)}}else $("#tooltip").remove(),k=null}),$(".sortableTable").tablesorter()}function formGeneral(){"use strict";$(".with-tooltip").tooltip({selector:".input-tooltip"}),$("#autosize").autosize(),$("#limiter").inputlimiter({limit:140,remText:"You only have %n character%s remaining...",limitText:"You're allowed to input %n character%s into this field."}),$("#tags").tagsInput(),$(".chzn-select").chosen(),$(".chzn-select-deselect").chosen({allow_single_deselect:!0}),$(".uniform").uniform(),$("#validVal").validVal(),$("#cp1").colorpicker({format:"hex"}),$("#cp2").colorpicker(),$("#cp3").colorpicker(),$("#cp4").colorpicker().on("changeColor",function(a){$("#colorPickerBlock").css("background-color",a.color.toHex())}),$("#dp1").datepicker({format:"mm-dd-yyyy"}),$("#dp2").datepicker(),$("#dp3").datepicker(),$("#dp3").datepicker(),$("#dpYears").datepicker(),$("#dpMonths").datepicker();var a=new Date(2014,1,20),b=new Date(2014,1,25);$("#dp4").datepicker().on("changeDate",function(c){c.date.valueOf()>b.valueOf()?$("#alert").show().find("strong").text("The start date can not be greater then the end date"):($("#alert").hide(),a=new Date(c.date),$("#startDate").text($("#dp4").data("date"))),$("#dp4").datepicker("hide")}),$("#dp5").datepicker().on("changeDate",function(c){c.date.valueOf()'+a+"");jQuery("#external-events").append(d),c(d)};$("#external-events li.external-event").each(function(){c($(this))}),$("#add-event").click(function(){var a=$("#title").val(),b=$("input:radio[name=priority]:checked").val();d(a,b)}),$("#calendar").fullCalendar({header:b,buttonText:{prev:'',next:''},editable:!0,droppable:!0,drop:function(a,b){var c=$(this).data("eventObject"),d=$.extend({},c);d.start=a,d.allDay=b,$("#calendar").fullCalendar("renderEvent",d,!0),$("#drop-remove").is(":checked")&&$(this).remove()},windowResize:function(){$("#calendar").fullCalendar("render")}})}function metisFile(){"use strict";$("#elfinder").elfinder({url:"assets/elfinder-2.0-rc1/php/connector.php"}).elfinder("instance")}function metisMaps(){"use strict";var a,b,c,d,e,f,g;a=new GMaps({el:"#gmaps-basic",lat:-12.043333,lng:-77.028333,zoomControl:!0,zoomControlOpt:{style:"SMALL",position:"TOP_LEFT"},panControl:!1,streetViewControl:!1,mapTypeControl:!1,overviewMapControl:!1}),b=new GMaps({el:"#gmaps-marker",lat:-12.043333,lng:-77.028333}),b.addMarker({lat:-12.043333,lng:-77.03,title:"Lima",details:{database_id:42,author:"HPNeo"},click:function(a){console.log&&console.log(a),alert("You clicked in this marker")},mouseover:function(a){console.log&&console.log(a)}}),b.addMarker({lat:-12.042,lng:-77.028333,title:"Marker with InfoWindow",infoWindow:{content:"

HTML Content

"}}),c=new GMaps({el:"#gmaps-geolocation",lat:-12.043333,lng:-77.028333}),GMaps.geolocate({success:function(a){c.setCenter(a.coords.latitude,a.coords.longitude)},error:function(a){alert("Geolocation failed: "+a.message)},not_supported:function(){alert("Your browser does not support geolocation")},always:function(){}}),d=new GMaps({el:"#gmaps-polylines",lat:-12.043333,lng:-77.028333,click:function(a){console.log(a)}}),f=[[-12.044012922866312,-77.02470665341184],[-12.05449279282314,-77.03024273281858],[-12.055122327623378,-77.03039293652341],[-12.075917129727586,-77.02764635449216],[-12.07635776902266,-77.02792530422971],[-12.076819390363665,-77.02893381481931],[-12.088527520066453,-77.0241058385925],[-12.090814532191756,-77.02271108990476]],d.drawPolyline({path:f,strokeColor:"#131540",strokeOpacity:.6,strokeWeight:6}),e=new GMaps({el:"#gmaps-route",lat:-12.043333,lng:-77.028333}),e.drawRoute({origin:[-12.044012922866312,-77.02470665341184],destination:[-12.090814532191756,-77.02271108990476],travelMode:"driving",strokeColor:"#131540",strokeOpacity:.6,strokeWeight:6}),g=new GMaps({el:"#gmaps-geocoding",lat:-12.043333,lng:-77.028333}),$("#geocoding_form").submit(function(a){a.preventDefault(),GMaps.geocode({address:$("#address").val().trim(),callback:function(a,b){if("OK"===b){var c=a[0].geometry.location;g.setCenter(c.lat(),c.lng()),g.addMarker({lat:c.lat(),lng:c.lng()})}}})})}function metisSortable(){$(".inner .row").sortable({})}function metisTable(){"use strict";$(".sortableTable").tablesorter(),$("#dataTable").dataTable({sDom:"<'pull-right'l>t<'row'<'col-lg-6'f><'col-lg-6'p>>",sPaginationType:"bootstrap",oLanguage:{sLengthMenu:"Show _MENU_ entries"}}),$("#actionTable button.remove").on("click",function(){$(this).closest("tr").remove()}),$("#actionTable button.edit").on("click",function(){$("#editModal").modal({show:!0});var a=$(this).closest("tr").children("td").eq(1),b=$(this).closest("tr").children("td").eq(2),c=$(this).closest("tr").children("td").eq(3);$("#editModal #fName").val(a.html()),$("#editModal #lName").val(b.html()),$("#editModal #uName").val(c.html()),$("#editModal #sbmtBtn").on("click",function(){a.html($("#editModal #fName").val()),b.html($("#editModal #lName").val()),c.html($("#editModal #uName").val())})})}function metisPricing(){$("#dark-toggle label").on("click",function(){var a=$(this);$("ul.dark li.active").removeClass("primary success danger warning info default").addClass(a.find("input").val())}),$("#light-toggle label").on("click",function(){var a=$(this);$("ul#light li.active").removeClass("primary success danger warning info default").addClass(a.find("input").val())})}function progRess(){window.prettyPrint&&prettyPrint(),$.each($(".progress .progress-bar"),function(){$(this).animate({width:$(this).attr("aria-valuenow")+"%"}),$(this).popover({placement:"bottom",title:"Source",content:this.outerHTML})})}$(function(){"use strict";var a=$.initNamespaceStorage("auth"),b=a.localStorage,c=a.sessionStorage,d=["submit_key","submit_secret","submit_dir"];if(c.isSet(d)){AWS.config.region="eu-west-1",AWS.config.update({accessKeyId:c.get("submit_key"),secretAccessKey:c.get("submit_secret")});var e=new AWS.S3({params:{Bucket:"librelio-europe"}});e.listObjects(function(a,b){console.log(null===a?b:a)})}var f=b.get("remember")===!0?b:c;!f.isSet(["key","secret","dir"])}),$(function(){"use strict";$("a[href=#]").on("click",function(a){a.preventDefault()}),$("a[data-toggle=tooltip]").tooltip(),$("a[data-tooltip=tooltip]").tooltip(),$(".minimize-box").on("click",function(a){a.preventDefault();var b=$(this).children("i");b.hasClass("icon-chevron-down")?b.removeClass("icon-chevron-down").addClass("icon-chevron-up"):b.hasClass("icon-chevron-up")&&b.removeClass("icon-chevron-up").addClass("icon-chevron-down")}),$(".close-box").click(function(){$(this).closest(".box").hide("slow")}),$("#changeSidebarPos").on("click",function(){$("body").toggleClass("hide-sidebar")}),$("li.accordion-group > a").on("click",function(){$(this).children("span").children("i").toggleClass("icon-angle-down")}),$("#menu-toggle").on("click",function(a){$("#left").toggleClass("opened"),a.preventDefault()}),$("#menu").metisMenu()});var toggleFullScreen={init:function(){void 0!==window.screenfull&&screenfull.enabled?$("#toggleFullScreen").on("click",function(a){screenfull.toggle(window.document[0]),$("body").toggleClass("fullScreen"),a.preventDefault()}):$("#toggleFullScreen").addClass("hidden")}};toggleFullScreen.init();var boxFullScreen={init:function(){void 0!==window.screenfull&&screenfull.enabled?$(".full-box").on("click",function(a){var b=$(this).parents(".box")[0];screenfull.toggle(b),$(this).parents(".box").toggleClass("full-screen-box"),$(this).parents(".box").children(".body").toggleClass("full-screen-box"),$(this).children("i").toggleClass("fa-compress"),a.preventDefault()}):$(".full-box").addClass("hidden")}};boxFullScreen.init();var panelBodyCollapse={init:function(){var a=$(".collapse-box"),b=a.closest(".box").children(".body");b.collapse("show"),a.on("click",function(a){var b=$(this).closest(".box").children(".body"),c=$(this).children("i");b.on("show.bs.collapse",function(){c.removeClass("fa-minus fa-plus").addClass("fa-spinner fa-spin")}),b.on("shown.bs.collapse",function(){c.removeClass("fa-spinner fa-spin").addClass("fa-minus")}),b.on("hide.bs.collapse",function(){c.removeClass("fa-minus fa-plus").addClass("fa-spinner fa-spin")}),b.on("hidden.bs.collapse",function(){c.removeClass("fa-spinner fa-spin").addClass("fa-plus")}),b.collapse("toggle"),a.preventDefault()})}};panelBodyCollapse.init();var boxHiding={init:function(){$(".close-box").click(function(){$(this).closest(".box").hide("slow")})}};boxHiding.init(),function(a,b){function c(b,c){this.element=b,this.settings=a.extend({},e,c),this._defaults=e,this._name=d,this.init()}var d="metisMenu",e={toggle:!0,hidingClass:"u-isHiddenVisually"};c.prototype={init:function(){function c(){a("body").removeClass("mini-sidebar"),g.find("li.active").has("ul").children("ul").addClass("collapse in"),g.find("li").not(".active").has("ul").children("ul").addClass("collapse"),g.find("li").has("ul").children("a").on("click",function(b){b.preventDefault(),a(this).parent("li").toggleClass("opened").children("ul").collapse("toggle"),h&&a(this).parent("li").siblings().removeClass("opened").children("ul.in").collapse("hide")})}function d(){g.find("li").has("ul").children("ul").removeClass("collapse in").css("height","inherit"),g.hasClass("affix")||g.find("li").has("ul").children("a").off("click")}function e(){a(b).width()<992?c():d()}{var f,g=a(this.element),h=this.settings.toggle;this.settings.hidingClass}e(),g.on("affix.bs.affix",function(){console.log("affix.bs.affix")}),g.on("affix-top.bs.affix",function(){console.log("affix-top.bs.affix")}),g.on("affixed.bs.affix",function(){c(),console.log("affixed.bs.affix")}),g.on("affixed-top.bs.affix",function(){d(),console.log("affixed-top.bs.affix")}),a(b).resize(function(){clearTimeout(f),f=setTimeout(e,250)})}},a.fn[d]=function(b){return this.each(function(){a.data(this,"plugin_"+d)||a.data(this,"plugin_"+d,new c(this,b))})}}(jQuery,window,document); \ No newline at end of file diff --git a/dist/assets/lib/jquery-storage-api/CHANGELOG.txt b/dist/assets/lib/jquery-storage-api/CHANGELOG.txt new file mode 100644 index 0000000..8d4f53e --- /dev/null +++ b/dist/assets/lib/jquery-storage-api/CHANGELOG.txt @@ -0,0 +1,47 @@ +1.7.1 + If cookie fallback, don't override window.localStorage/sessionStorage but use window.localCookieStorage/sessionCookieStorage + +1.7.0 + Add support of js syntax on all methods + Add bower.json + +1.6.0 + Add methods setPath, setDomain, setConf, setDefaultConf to cookie storage + +1.5.0 + On "infinite arguments mode", add possibility to have an array/object on last argument on get, set, remove, isEmpty, isSet methods + Simplify code + Some fixes + +1.4.0 + Add keys(), isEmpty(), isSet() methods on storages + Add $.removeAllStorages() method + Add $.namespaceStorages variable + Some fixes + Add Jasmine specs + +1.3.1 + Fix on set function with syntax set('foo','foo2','foo3'...,'value') + +1.3.0 + Change delete function names (IE8 doesn't like "delete", so rename to "remove") + +1.2.1 + Change keywords in manifest + +1.2.0 + Add fallback with cookies + Add cookieStorage + Fix value returned by set() on namespace + +1.1.1 + Fix on get() exception + Add minified version + +1.1.0 + First parameter of get() & delete() can be an array + First parameter of set() can be an object + Correct initialisation of namespace (create it if not exists) and deleteAll truncate it (before, namespace was deleted) + +1.0.0 + Initial version diff --git a/dist/assets/lib/jquery-storage-api/README.md b/dist/assets/lib/jquery-storage-api/README.md new file mode 100644 index 0000000..27373f1 --- /dev/null +++ b/dist/assets/lib/jquery-storage-api/README.md @@ -0,0 +1,187 @@ +jQuery Storage API +================== + +jQuery Storage API is a plugin that simplify access to storages (HTML5) & cookies, add namespace storage functionality and provide compatiblity for old browsers with cookies! + +Functionalities: +* To store object easily, encode/decode it with JSON automatically +* Ability to define namespace and use it as a specific storage +* Magic getter and setter to have access at an infinite object level with one call +* Add jquery.cookie and manage your cookies with this API +* You want use storage on old browsers? Add jquery.cookie & JSON and JQuery Storage API use cookies to simulate storage! + + +Storages +-------- +#### Local storage + $.localStorage + +#### Session storage + $.sessionStorage + +#### Cookie storage (only if jquery.cookie added) + $.cookieStorage + +#### Namespace storage + ns=$.initNamespaceStorage('ns_name'); + ns.localStorage // Namespace in localStorage + ns.sessionStorage // Namespace in sessionStorage + ns.cookieStorage // Namespace in cookieStorage (only if jquery.cookie added) + +Public methods on storage +------------------------- + +Public methods are usable on all storage objects ($.localStorage, $.sessionStorage, $.cookieStorage or object returned by $.initNamespaceStorage) + + storage=$.localStorage + +### `get()` +Get an item from a storage. +If last argument is an array (can be preceded by other arguments to parse storage), get() return an object with value for each item of this array. + + storage.get('foo') // Return storage.foo + storage.get('foo.foo2.foo3...') // Return storage.foo.foo2.foo3... + storage.get('foo','foo2','foo3'...) // Return storage.foo.foo2.foo3... + storage.get(['foo','foo2']) // Return {foo:storage.foo,foo2:storage.foo2} + +### `set()` +Set an item in a storage. +If argument is an object, set() set value on storage for each property of this object. + + storage.set('foo','value') // Set storage.foo to "value" + storage.set('foo.foo2.foo3...','value') // Set storage.foo.foo2.foo3... to "value" + storage.set('foo','foo2','foo3'...,'value') // Set storage.foo.foo2.foo3... to "value" + storage.set({'foo':'value,'foo2':'value2'}) // Set storage.foo to "value" and storage.foo2 to "value2" + +### `keys()` +Get keys of a storage or an item in a storage. + + storage.set('foo','value') + storage.set('foo2','foo3'..., {'foo4':'value4,'foo5':'value5'}) + storage.keys() // Return keys of storage (["foo", "foo2"]) + storage.keys('foo2') // Return keys of storage.foo2 (["foo3"]) + storage.keys('foo2.foo3...') // Return keys of storage.foo2.foo3... (["foo4", "foo5"]) + storage.keys('foo2','foo3'...) // Return keys of storage.foo2.foo3... (["foo4", "foo5"]) + +### `isEmpty()` +Check if a storage or an item in a storage is empty (if equal to "", 0, null, undefined, [] or {}). +If last argument is an array (can be preceded by other arguments to parse storage), isEmpty() test storage for each item of this array, and return true only if all test return true. + + storage.set('foo','value') + storage.set('foo2','foo3'..., {'foo4':'value4,'foo5':'value5'}) + storage.set('foo6','') + storage.set('foo7',{}) + storage.isEmpty('foo') // Check if storage.foo is empty (false) + storage.isEmpty('foo6') // Check if storage.foo6 is empty (true) + storage.isEmpty('foo7') // Check if storage.foo7 is empty (true) + storage.isEmpty('foo2.foo3...') // Check if storage.foo2.foo3... is empty (false) + storage.isEmpty('foo2','foo3'...) // Check if storage.foo2.foo3... is empty (false) + storage.isEmpty(['foo','foo2']) // Check if storage.foo and storage.foo2 are empty (false) + storage.isEmpty(['foo','foo7']) // Check if storage.foo and storage.foo7 are empty (false) + storage.isEmpty(['foo6','foo7']) // Check if storage.foo6 and storage.foo7 are empty (true) + storage.isEmpty('foo2','foo3'...,['foo6','foo7']) // Check if storage.foo2.foo3...foo6 and storage.foo2.foo3...foo7 are empty (true) + +### `isSet()` +Check if an item exists in a storage (if different of null and undefined). +If last argument is an array (can be preceded by other arguments to parse storage), isSet() test storage for each item of this array, and return true only if all test return true. + + storage.set('foo','value') + storage.set('foo2','foo3'..., {'foo4':'value4,'foo5':'value5'}) + storage.set('foo6','') + storage.isSet('foo') // Check if storage.foo exists (true) + storage.isSet('foo6') // Check if storage.foo6 exists (true) + storage.isSet('foo7') // Check if storage.foo7 exists (false) + storage.isSet('foo2.foo3'...) // Check if storage.foo2.foo3... exists (true) + storage.isSet('foo2','foo3'...) // Check if storage.foo2.foo3... exists (true) + storage.isSet(['foo','foo2']) // Check if storage.foo and storage.foo2 exist (true) + storage.isSet(['foo','foo7']) // Check if storage.foo and storage.foo7 exist (false) + storage.isSet('foo2','foo3'...,['foo6','foo7']) // Check if storage.foo2.foo3...foo6 and storage.foo2.foo3...foo7 exist (false) + +### `remove()` +Delete an item from a storage. +If last argument is an array (can be preceded by other arguments to parse storage), remove() remove value of storage for each item of this array. + + storage.remove('foo') // Delete storage.foo + storage.remove('foo.foo2.foo3'...) // Delete storage.foo.foo2.foo3... + storage.remove('foo','foo2','foo3'...) // Delete storage.foo.foo2.foo3... + storage.remove(['foo','foo2']) // Delete storage.foo and storage.foo2 + +### `removeAll()` +Truncate the storage + + storage.removeAll() // Delete all items from the storage + storage.removeAll(true) // Only on global storages. Delete all items from the storage and reinitialize previously initialized namespaces + +### `setExpires()` +Only on cookieStorage. Set expires date in days (default value is null, cookie is valid for session only; only cookies setted after setExpires() call will be affected). + + storage.setExpires(10) // Set expiry date to today + 10 days + +This method return the storage object, so you can do : + + storage.setExpires(10).set('foo','value') // Set expiry date to today + 10 days and set a new cookie + +### `setPath()` +Only on cookieStorage. Set path for cookies (default value is null; only cookies setted after setPath() call will be affected). + + storage.setPath('/') // Set path to '/' + +This method return the storage object, so you can do : + + storage.setPath('/').set('foo','value') // Set path to '/' and set a new cookie + +### `setDomain()` +Only on cookieStorage. Set domain for cookies (default value is null; only cookies setted after setDomain() call will be affected). + + storage.setDomain('www.ndd.com') // Set domain to www.ndd.com + +This method return the storage object, so you can do : + + storage.setDomain('www.ndd.com').set('foo','value') // Set domain to www.ndd.com and set a new cookie + +### `setConf()` +Only on cookieStorage. Set cookie configuration with an object (only cookies setted after setConf() call will be affected). + + storage.setConf({path:'/',expires:10,'domain':'www.ndd.com'}) // Set expiry date, domain and path + +This method return the storage object, so you can do : + + storage.setConf({path:'/',expires:10}).set('foo','value') // Set configuration and set a new cookie + +### `setDefaultConf()` +Only on cookieStorage. Set default configuration (only cookies setted after setDefaultConf() call will be affected). + + storage.setDefaultConf() // Set path, domain and expiry date to null + +This method return the storage object, so you can do : + + storage.setDefaultConf().set('foo','value') // Set default configuration and set a new cookie + +### `$.namespaceStorages` +Object that contains all initilialized namespace storages + +### `$.removeAllStorages()` +Delete all items of all storages. +As removeAll(), is first argument is given to true, namespaces are reinitialized. +Else, $.namespaceStorages is set to an empty object and previously namespaces are lost. + + + +Compatibility +------------- + +JQuery Storage API is compatible with all browsers that support storage and JSON natively. + +If you want more compatibility : +* Add jquery.cookie (https://github.com/carhartl/jquery-cookie) before this plugin and storage will work on every browsers that support JSON natively! +* You want more? Add json2.js (https://github.com/douglascrockford/JSON-js) too and storage will be enable on every browsers! + + + +Migration +--------- + +### 1.2.x => 1.3.0 +To resolve an issue on IE8 that doesn't like function named "delete", we had to change name of delete functions. +So public methods "delete" and "deleteAll" become "remove" and "removeAll". +Sorry for inconvenience... diff --git a/dist/assets/lib/jquery-storage-api/bower.json b/dist/assets/lib/jquery-storage-api/bower.json new file mode 100644 index 0000000..d012c91 --- /dev/null +++ b/dist/assets/lib/jquery-storage-api/bower.json @@ -0,0 +1,41 @@ +{ + "name": "jQuery-Storage-API", + "title": "jQuery Storage API", + "version": "1.7.1", + "main": "jquery.storageapi.js", + "description": "jQuery Storage API is a plugin that simplify access to storages (HTML5) & cookies, add namespace storage functionality and provide compatiblity for old browsers with cookies!", + "keywords": [ + "jquery", + "storage", + "html5", + "localStorage", + "sessionStorage", + "cookie", + "namespace" + ], + "author": { + "name": "Julien Maurel", + "url": "https://github.com/julien-maurel" + }, + "licenses": [ + { + "type": "MIT", + "url": "http://www.opensource.org/licenses/mit-license.php" + } + ], + "homepage": "https://github.com/julien-maurel/jQuery-Storage-API", + "bugs": "https://github.com/julien-maurel/jQuery-Storage-API/issues", + "repository": { + "type": "git", + "url": "git://github.com/julien-maurel/jQuery-Storage-API.git" + }, + "ignore": [ + "Jasmine", + "/*.md", + "/*.txt", + "/*.json" + ], + "dependencies": { + "jquery": ">=1.4" + } +} \ No newline at end of file diff --git a/dist/assets/lib/jquery-storage-api/jquery.storageapi.js b/dist/assets/lib/jquery-storage-api/jquery.storageapi.js new file mode 100644 index 0000000..a42aa9a --- /dev/null +++ b/dist/assets/lib/jquery-storage-api/jquery.storageapi.js @@ -0,0 +1,424 @@ +/* + * jQuery Storage API Plugin + * + * Copyright (c) 2013 Julien Maurel + * + * Licensed under the MIT license: + * http://www.opensource.org/licenses/mit-license.php + * + * Project home: + * https://github.com/julien-maurel/jQuery-Storage-API + * + * Version: 1.7.1 + * + */ +(function($){ + // Prefix to use with cookie fallback + var cookie_local_prefix="ls_"; + var cookie_session_prefix="ss_"; + + // Get items from a storage + function _get(storage){ + var l=arguments.length,s=window[storage],a=arguments,a1=a[1],vi,ret,tmp; + if(l<2) throw new Error('Minimum 2 arguments must be given'); + else if($.isArray(a1)){ + // If second argument is an array, return an object with value of storage for each item in this array + ret={}; + for(var i in a1){ + vi=a1[i]; + try{ + ret[vi]=JSON.parse(s.getItem(vi)); + }catch(e){ + ret[vi]=s.getItem(vi); + } + } + return ret; + }else if(l==2){ + // If only 2 arguments, return value directly + try{ + return JSON.parse(s.getItem(a1)); + }catch(e){ + return s.getItem(a1); + } + }else{ + // If more than 2 arguments, parse storage to retrieve final value to return it + // Get first level + try{ + ret=JSON.parse(s.getItem(a1)); + }catch(e){ + throw new ReferenceError(a1+' is not defined in this storage'); + } + // Parse next levels + for(var i=2;i1){ + o=_get.apply(this,a); + }else{ + o=s; + } + if(o._cookie){ + // If storage is a cookie, use $.cookie to retrieve keys + for(var key in $.cookie()){ + if(key!='') { + keys.push(key.replace(o._prefix,'')); + } + } + }else{ + for(var i in o){ + keys.push(i); + } + } + return keys; + } + + // Create new namespace storage + function _createNamespace(name){ + if(!name || typeof name!="string") throw new Error('First parameter must be a string'); + if(window.localStorage){ + if(!window.localStorage.getItem(name)) window.localStorage.setItem(name,'{}'); + if(!window.sessionStorage.getItem(name)) window.sessionStorage.setItem(name,'{}'); + }else{ + if(!window.localCookieStorage.getItem(name)) window.localCookieStorage.setItem(name,'{}'); + if(!window.sessionCookieStorage.getItem(name)) window.sessionCookieStorage.setItem(name,'{}'); + } + var ns={ + localStorage:$.extend({},$.localStorage,{_ns:name}), + sessionStorage:$.extend({},$.sessionStorage,{_ns:name}) + }; + if($.cookie){ + if(!window.cookieStorage.getItem(name)) window.cookieStorage.setItem(name,'{}'); + ns.cookieStorage=$.extend({},$.cookieStorage,{_ns:name}); + } + $.namespaceStorages[name]=ns; + return ns; + } + + // Namespace object + var storage={ + _type:'', + _ns:'', + _callMethod:function(f,a){ + var p=[this._type],a=Array.prototype.slice.call(a),a0=a[0]; + if(this._ns) p.push(this._ns); + if(typeof a0==='string' && a0.indexOf('.')!==-1){ + a.shift(); + [].unshift.apply(a,a0.split('.')); + } + [].push.apply(p,a); + return f.apply(this,p); + }, + // Get items. If no parameters and storage have a namespace, return all namespace + get:function(){ + return this._callMethod(_get,arguments); + }, + // Set items + set:function(){ + var l=arguments.length,a=arguments,a0=a[0]; + if(l<1 || !$.isPlainObject(a0) && l<2) throw new Error('Minimum 2 arguments must be given or first parameter must be an object'); + // If first argument is an object and storage is a namespace storage, set values individually + if($.isPlainObject(a0) && this._ns){ + for(var i in a0){ + _set(this._type,this._ns,i,a0[i]); + } + return a0; + }else{ + var r=this._callMethod(_set,a); + if(this._ns) return r[a0.split('.')[0]]; + else return r; + } + }, + // Delete items + remove:function(){ + if(arguments.length<1) throw new Error('Minimum 1 argument must be given'); + return this._callMethod(_remove,arguments); + }, + // Delete all items + removeAll:function(reinit_ns){ + if(this._ns){ + _set(this._type,this._ns,{}); + return true; + }else{ + return _removeAll(this._type, reinit_ns); + } + }, + // Items empty + isEmpty:function(){ + return this._callMethod(_isEmpty,arguments); + }, + // Items exists + isSet:function(){ + if(arguments.length<1) throw new Error('Minimum 1 argument must be given'); + return this._callMethod(_isSet,arguments); + }, + // Get keys of items + keys:function(){ + return this._callMethod(_keys,arguments); + } + }; + + // Use jquery.cookie for compatibility with old browsers and give access to cookieStorage + if($.cookie){ + // sessionStorage is valid for one window/tab. To simulate that with cookie, we set a name for the window and use it for the name of the cookie + if(!window.name) window.name=Math.floor(Math.random()*100000000); + var cookie_storage={ + _cookie:true, + _prefix:'', + _expires:null, + _path:null, + _domain:null, + setItem:function(n,v){ + $.cookie(this._prefix+n,v,{expires:this._expires,path:this._path,domain:this._domain}); + }, + getItem:function(n){ + return $.cookie(this._prefix+n); + }, + removeItem:function(n){ + return $.removeCookie(this._prefix+n); + }, + clear:function(){ + for(var key in $.cookie()){ + if(key!=''){ + if(!this._prefix && key.indexOf(cookie_local_prefix)===-1 && key.indexOf(cookie_session_prefix)===-1 || this._prefix && key.indexOf(this._prefix)===0) { + $.removeCookie(key); + } + } + } + }, + setExpires:function(e){ + this._expires=e; + return this; + }, + setPath:function(p){ + this._path=p; + return this; + }, + setDomain:function(d){ + this._domain=d; + return this; + }, + setConf:function(c){ + if(c.path) this._path=c.path; + if(c.domain) this._domain=c.domain; + if(c.expires) this._expires=c.expires; + return this; + }, + setDefaultConf:function(){ + this._path=this._domain=this._expires=null; + } + }; + if(!window.localStorage){ + window.localCookieStorage=$.extend({},cookie_storage,{_prefix:cookie_local_prefix,_expires:365*10}); + window.sessionCookieStorage=$.extend({},cookie_storage,{_prefix:cookie_session_prefix+window.name+'_'}); + } + window.cookieStorage=$.extend({},cookie_storage); + // cookieStorage API + $.cookieStorage=$.extend({},storage,{ + _type:'cookieStorage', + setExpires:function(e){window.cookieStorage.setExpires(e); return this;}, + setPath:function(p){window.cookieStorage.setPath(p); return this;}, + setDomain:function(d){window.cookieStorage.setDomain(d); return this;}, + setConf:function(c){window.cookieStorage.setConf(c); return this;}, + setDefaultConf:function(){window.cookieStorage.setDefaultConf(); return this;} + }); + } + + // Get a new API on a namespace + $.initNamespaceStorage=function(ns){ return _createNamespace(ns); }; + if (window.localStorage) { + // localStorage API + $.localStorage=$.extend({},storage,{_type:'localStorage'}); + // sessionStorage API + $.sessionStorage=$.extend({},storage,{_type:'sessionStorage'}); + }else{ + // localStorage API + $.localStorage=$.extend({},storage,{_type:'localCookieStorage'}); + // sessionStorage API + $.sessionStorage=$.extend({},storage,{_type:'sessionCookieStorage'}); + } + // List of all namespace storage + $.namespaceStorages={}; + // Remove all items in all storages + $.removeAllStorages=function(reinit_ns){ + $.localStorage.removeAll(reinit_ns); + $.sessionStorage.removeAll(reinit_ns); + if($.cookieStorage) $.cookieStorage.removeAll(reinit_ns); + if(!reinit_ns){ + $.namespaceStorages={}; + } + } +})(jQuery); diff --git a/dist/assets/lib/jquery-storage-api/jquery.storageapi.min.js b/dist/assets/lib/jquery-storage-api/jquery.storageapi.min.js new file mode 100644 index 0000000..4ab5d03 --- /dev/null +++ b/dist/assets/lib/jquery-storage-api/jquery.storageapi.min.js @@ -0,0 +1,2 @@ +/* jQuery Storage API Plugin 1.7.1 https://github.com/julien-maurel/jQuery-Storage-API */ +!function(e){function t(t){var r,i,n,o=arguments.length,s=window[t],a=arguments,u=a[1];if(2>o)throw Error("Minimum 2 arguments must be given");if(e.isArray(u)){i={};for(var f in u){r=u[f];try{i[r]=JSON.parse(s.getItem(r))}catch(g){i[r]=s.getItem(r)}}return i}if(2!=o){try{i=JSON.parse(s.getItem(u))}catch(g){throw new ReferenceError(u+" is not defined in this storage")}for(var f=2;o-1>f;f++)if(i=i[a[f]],void 0===i)throw new ReferenceError([].slice.call(a,1,f+1).join(".")+" is not defined in this storage");if(e.isArray(a[f])){n=i,i={};for(var c in a[f])i[a[f][c]]=n[a[f][c]];return i}return i[a[f]]}try{return JSON.parse(s.getItem(u))}catch(g){return s.getItem(u)}}function i(t){var r,i,n=arguments.length,o=window[t],s=arguments,a=s[1],u=s[2],f={};if(2>n||!e.isPlainObject(a)&&3>n)throw Error("Minimum 3 arguments must be given or second parameter must be an object");if(e.isPlainObject(a)){for(var g in a)r=a[g],e.isPlainObject(r)?o.setItem(g,JSON.stringify(r)):o.setItem(g,r);return a}if(3==n)return"object"==typeof u?o.setItem(a,JSON.stringify(u)):o.setItem(a,u),u;try{i=o.getItem(a),null!=i&&(f=JSON.parse(i))}catch(c){}i=f;for(var g=2;n-2>g;g++)r=s[g],i[r]&&e.isPlainObject(i[r])||(i[r]={}),i=i[r];return i[s[g]]=s[g+1],o.setItem(a,JSON.stringify(f)),f}function n(t){var r,i,n=arguments.length,o=window[t],s=arguments,a=s[1];if(2>n)throw Error("Minimum 2 arguments must be given");if(e.isArray(a)){for(var u in a)o.removeItem(a[u]);return!0}if(2==n)return o.removeItem(a),!0;try{r=i=JSON.parse(o.getItem(a))}catch(f){throw new ReferenceError(a+" is not defined in this storage")}for(var u=2;n-1>u;u++)if(i=i[s[u]],void 0===i)throw new ReferenceError([].slice.call(s,1,u).join(".")+" is not defined in this storage");if(e.isArray(s[u]))for(var g in s[u])delete i[s[u][g]];else delete i[s[u]];return o.setItem(a,JSON.stringify(r)),!0}function o(t,r){var i=u(t);for(var o in i)n(t,i[o]);if(r)for(var o in e.namespaceStorages)f(o)}function s(r){var i=arguments.length,n=arguments,o=(window[r],n[1]);if(1==i)return 0==u(r).length;if(e.isArray(o)){for(var a=0;ai)throw Error("Minimum 2 arguments must be given");if(e.isArray(o)){for(var s=0;s1?t.apply(this,o):n,a._cookie)for(var u in e.cookie())""!=u&&s.push(u.replace(a._prefix,""));else for(var f in a)s.push(f);return s}function f(t){if(!t||"string"!=typeof t)throw Error("First parameter must be a string");window.localStorage?(window.localStorage.getItem(t)||window.localStorage.setItem(t,"{}"),window.sessionStorage.getItem(t)||window.sessionStorage.setItem(t,"{}")):(window.localCookieStorage.getItem(t)||window.localCookieStorage.setItem(t,"{}"),window.sessionCookieStorage.getItem(t)||window.sessionCookieStorage.setItem(t,"{}"));var r={localStorage:e.extend({},e.localStorage,{_ns:t}),sessionStorage:e.extend({},e.sessionStorage,{_ns:t})};return e.cookie&&(window.cookieStorage.getItem(t)||window.cookieStorage.setItem(t,"{}"),r.cookieStorage=e.extend({},e.cookieStorage,{_ns:t})),e.namespaceStorages[t]=r,r}var g="ls_",c="ss_",m={_type:"",_ns:"",_callMethod:function(e,t){var r=[this._type],t=Array.prototype.slice.call(t),i=t[0];return this._ns&&r.push(this._ns),"string"==typeof i&&-1!==i.indexOf(".")&&(t.shift(),[].unshift.apply(t,i.split("."))),[].push.apply(r,t),e.apply(this,r)},get:function(){return this._callMethod(t,arguments)},set:function(){var t=arguments.length,n=arguments,o=n[0];if(1>t||!e.isPlainObject(o)&&2>t)throw Error("Minimum 2 arguments must be given or first parameter must be an object");if(e.isPlainObject(o)&&this._ns){for(var s in o)i(this._type,this._ns,s,o[s]);return o}return r=this._callMethod(i,n),this._ns?r[o.split(".")[0]]:r},remove:function(){if(arguments.length<1)throw Error("Minimum 1 argument must be given");return this._callMethod(n,arguments)},removeAll:function(e){return this._ns?(i(this._type,this._ns,{}),!0):o(this._type,e)},isEmpty:function(){return this._callMethod(s,arguments)},isSet:function(){if(arguments.length<1)throw Error("Minimum 1 argument must be given");return this._callMethod(a,arguments)},keys:function(){return this._callMethod(u,arguments)}};if(e.cookie){window.name||(window.name=Math.floor(1e8*Math.random()));var l={_cookie:!0,_prefix:"",_expires:null,_path:null,_domain:null,setItem:function(t,r){e.cookie(this._prefix+t,r,{expires:this._expires,path:this._path,domain:this._domain})},getItem:function(t){return e.cookie(this._prefix+t)},removeItem:function(t){return e.removeCookie(this._prefix+t)},clear:function(){for(var t in e.cookie())""!=t&&(!this._prefix&&-1===t.indexOf(g)&&-1===t.indexOf(c)||this._prefix&&0===t.indexOf(this._prefix))&&e.removeCookie(t)},setExpires:function(e){return this._expires=e,this},setPath:function(e){return this._path=e,this},setDomain:function(e){return this._domain=e,this},setConf:function(e){return e.path&&(this._path=e.path),e.domain&&(this._domain=e.domain),e.expires&&(this._expires=e.expires),this},setDefaultConf:function(){this._path=this._domain=this._expires=null}};window.localStorage||(window.localCookieStorage=e.extend({},l,{_prefix:g,_expires:3650}),window.sessionCookieStorage=e.extend({},l,{_prefix:c+window.name+"_"})),window.cookieStorage=e.extend({},l),e.cookieStorage=e.extend({},m,{_type:"cookieStorage",setExpires:function(e){return window.cookieStorage.setExpires(e),this},setPath:function(e){return window.cookieStorage.setPath(e),this},setDomain:function(e){return window.cookieStorage.setDomain(e),this},setConf:function(e){return window.cookieStorage.setConf(e),this},setDefaultConf:function(){return window.cookieStorage.setDefaultConf(),this}})}e.initNamespaceStorage=function(e){return f(e)},window.localStorage?(e.localStorage=e.extend({},m,{_type:"localStorage"}),e.sessionStorage=e.extend({},m,{_type:"sessionStorage"})):(e.localStorage=e.extend({},m,{_type:"localCookieStorage"}),e.sessionStorage=e.extend({},m,{_type:"sessionCookieStorage"})),e.namespaceStorages={},e.removeAllStorages=function(t){e.localStorage.removeAll(t),e.sessionStorage.removeAll(t),e.cookieStorage&&e.cookieStorage.removeAll(t),t||(e.namespaceStorages={})}}(jQuery); \ No newline at end of file diff --git a/dist/assets/lib/jquery-storage-api/storageapi.jquery.json b/dist/assets/lib/jquery-storage-api/storageapi.jquery.json new file mode 100644 index 0000000..e9780d3 --- /dev/null +++ b/dist/assets/lib/jquery-storage-api/storageapi.jquery.json @@ -0,0 +1,35 @@ +{ + "name": "storageapi", + "version": "1.7.1", + "title": "jQuery Storage API", + "author": { + "name": "Julien Maurel", + "url": "https://github.com/julien-maurel" + }, + "licenses": [ + { + "type": "MIT", + "url": "http://www.opensource.org/licenses/mit-license.php" + } + ], + "dependencies": { + "jquery": ">=1.4" + }, + "description": "jQuery Storage API is a plugin that simplify access to storages (HTML5) & cookies, add namespace storage functionality and provide compatiblity for old browsers with cookies!", + "keywords": [ + "jquery", + "storage", + "html5", + "localStorage", + "sessionStorage", + "cookie", + "namespace" + ], + "homepage": "https://github.com/julien-maurel/jQuery-Storage-API", + "bugs": "https://github.com/julien-maurel/jQuery-Storage-API/issues", + "docs": "https://github.com/julien-maurel/jQuery-Storage-API", + "demo": "https://github.com/julien-maurel/jQuery-Storage-API", + "files": [ + "jquery.storageapi.js" + ] +} diff --git a/dist/assets/lib/jquery.storageapi.min.js b/dist/assets/lib/jquery.storageapi.min.js new file mode 100644 index 0000000..4ab5d03 --- /dev/null +++ b/dist/assets/lib/jquery.storageapi.min.js @@ -0,0 +1,2 @@ +/* jQuery Storage API Plugin 1.7.1 https://github.com/julien-maurel/jQuery-Storage-API */ +!function(e){function t(t){var r,i,n,o=arguments.length,s=window[t],a=arguments,u=a[1];if(2>o)throw Error("Minimum 2 arguments must be given");if(e.isArray(u)){i={};for(var f in u){r=u[f];try{i[r]=JSON.parse(s.getItem(r))}catch(g){i[r]=s.getItem(r)}}return i}if(2!=o){try{i=JSON.parse(s.getItem(u))}catch(g){throw new ReferenceError(u+" is not defined in this storage")}for(var f=2;o-1>f;f++)if(i=i[a[f]],void 0===i)throw new ReferenceError([].slice.call(a,1,f+1).join(".")+" is not defined in this storage");if(e.isArray(a[f])){n=i,i={};for(var c in a[f])i[a[f][c]]=n[a[f][c]];return i}return i[a[f]]}try{return JSON.parse(s.getItem(u))}catch(g){return s.getItem(u)}}function i(t){var r,i,n=arguments.length,o=window[t],s=arguments,a=s[1],u=s[2],f={};if(2>n||!e.isPlainObject(a)&&3>n)throw Error("Minimum 3 arguments must be given or second parameter must be an object");if(e.isPlainObject(a)){for(var g in a)r=a[g],e.isPlainObject(r)?o.setItem(g,JSON.stringify(r)):o.setItem(g,r);return a}if(3==n)return"object"==typeof u?o.setItem(a,JSON.stringify(u)):o.setItem(a,u),u;try{i=o.getItem(a),null!=i&&(f=JSON.parse(i))}catch(c){}i=f;for(var g=2;n-2>g;g++)r=s[g],i[r]&&e.isPlainObject(i[r])||(i[r]={}),i=i[r];return i[s[g]]=s[g+1],o.setItem(a,JSON.stringify(f)),f}function n(t){var r,i,n=arguments.length,o=window[t],s=arguments,a=s[1];if(2>n)throw Error("Minimum 2 arguments must be given");if(e.isArray(a)){for(var u in a)o.removeItem(a[u]);return!0}if(2==n)return o.removeItem(a),!0;try{r=i=JSON.parse(o.getItem(a))}catch(f){throw new ReferenceError(a+" is not defined in this storage")}for(var u=2;n-1>u;u++)if(i=i[s[u]],void 0===i)throw new ReferenceError([].slice.call(s,1,u).join(".")+" is not defined in this storage");if(e.isArray(s[u]))for(var g in s[u])delete i[s[u][g]];else delete i[s[u]];return o.setItem(a,JSON.stringify(r)),!0}function o(t,r){var i=u(t);for(var o in i)n(t,i[o]);if(r)for(var o in e.namespaceStorages)f(o)}function s(r){var i=arguments.length,n=arguments,o=(window[r],n[1]);if(1==i)return 0==u(r).length;if(e.isArray(o)){for(var a=0;ai)throw Error("Minimum 2 arguments must be given");if(e.isArray(o)){for(var s=0;s1?t.apply(this,o):n,a._cookie)for(var u in e.cookie())""!=u&&s.push(u.replace(a._prefix,""));else for(var f in a)s.push(f);return s}function f(t){if(!t||"string"!=typeof t)throw Error("First parameter must be a string");window.localStorage?(window.localStorage.getItem(t)||window.localStorage.setItem(t,"{}"),window.sessionStorage.getItem(t)||window.sessionStorage.setItem(t,"{}")):(window.localCookieStorage.getItem(t)||window.localCookieStorage.setItem(t,"{}"),window.sessionCookieStorage.getItem(t)||window.sessionCookieStorage.setItem(t,"{}"));var r={localStorage:e.extend({},e.localStorage,{_ns:t}),sessionStorage:e.extend({},e.sessionStorage,{_ns:t})};return e.cookie&&(window.cookieStorage.getItem(t)||window.cookieStorage.setItem(t,"{}"),r.cookieStorage=e.extend({},e.cookieStorage,{_ns:t})),e.namespaceStorages[t]=r,r}var g="ls_",c="ss_",m={_type:"",_ns:"",_callMethod:function(e,t){var r=[this._type],t=Array.prototype.slice.call(t),i=t[0];return this._ns&&r.push(this._ns),"string"==typeof i&&-1!==i.indexOf(".")&&(t.shift(),[].unshift.apply(t,i.split("."))),[].push.apply(r,t),e.apply(this,r)},get:function(){return this._callMethod(t,arguments)},set:function(){var t=arguments.length,n=arguments,o=n[0];if(1>t||!e.isPlainObject(o)&&2>t)throw Error("Minimum 2 arguments must be given or first parameter must be an object");if(e.isPlainObject(o)&&this._ns){for(var s in o)i(this._type,this._ns,s,o[s]);return o}return r=this._callMethod(i,n),this._ns?r[o.split(".")[0]]:r},remove:function(){if(arguments.length<1)throw Error("Minimum 1 argument must be given");return this._callMethod(n,arguments)},removeAll:function(e){return this._ns?(i(this._type,this._ns,{}),!0):o(this._type,e)},isEmpty:function(){return this._callMethod(s,arguments)},isSet:function(){if(arguments.length<1)throw Error("Minimum 1 argument must be given");return this._callMethod(a,arguments)},keys:function(){return this._callMethod(u,arguments)}};if(e.cookie){window.name||(window.name=Math.floor(1e8*Math.random()));var l={_cookie:!0,_prefix:"",_expires:null,_path:null,_domain:null,setItem:function(t,r){e.cookie(this._prefix+t,r,{expires:this._expires,path:this._path,domain:this._domain})},getItem:function(t){return e.cookie(this._prefix+t)},removeItem:function(t){return e.removeCookie(this._prefix+t)},clear:function(){for(var t in e.cookie())""!=t&&(!this._prefix&&-1===t.indexOf(g)&&-1===t.indexOf(c)||this._prefix&&0===t.indexOf(this._prefix))&&e.removeCookie(t)},setExpires:function(e){return this._expires=e,this},setPath:function(e){return this._path=e,this},setDomain:function(e){return this._domain=e,this},setConf:function(e){return e.path&&(this._path=e.path),e.domain&&(this._domain=e.domain),e.expires&&(this._expires=e.expires),this},setDefaultConf:function(){this._path=this._domain=this._expires=null}};window.localStorage||(window.localCookieStorage=e.extend({},l,{_prefix:g,_expires:3650}),window.sessionCookieStorage=e.extend({},l,{_prefix:c+window.name+"_"})),window.cookieStorage=e.extend({},l),e.cookieStorage=e.extend({},m,{_type:"cookieStorage",setExpires:function(e){return window.cookieStorage.setExpires(e),this},setPath:function(e){return window.cookieStorage.setPath(e),this},setDomain:function(e){return window.cookieStorage.setDomain(e),this},setConf:function(e){return window.cookieStorage.setConf(e),this},setDefaultConf:function(){return window.cookieStorage.setDefaultConf(),this}})}e.initNamespaceStorage=function(e){return f(e)},window.localStorage?(e.localStorage=e.extend({},m,{_type:"localStorage"}),e.sessionStorage=e.extend({},m,{_type:"sessionStorage"})):(e.localStorage=e.extend({},m,{_type:"localCookieStorage"}),e.sessionStorage=e.extend({},m,{_type:"sessionCookieStorage"})),e.namespaceStorages={},e.removeAllStorages=function(t){e.localStorage.removeAll(t),e.sessionStorage.removeAll(t),e.cookieStorage&&e.cookieStorage.removeAll(t),t||(e.namespaceStorages={})}}(jQuery); \ No newline at end of file diff --git a/dist/bgcolor.html b/dist/bgcolor.html index bb03ce2..38315a7 100644 --- a/dist/bgcolor.html +++ b/dist/bgcolor.html @@ -320,6 +320,8 @@ + + diff --git a/dist/bgimage.html b/dist/bgimage.html index b6a9d83..74ee0f3 100644 --- a/dist/bgimage.html +++ b/dist/bgimage.html @@ -270,6 +270,8 @@ + + diff --git a/dist/blank.html b/dist/blank.html index 24c161a..1bb1036 100644 --- a/dist/blank.html +++ b/dist/blank.html @@ -240,6 +240,8 @@ + + diff --git a/dist/button.html b/dist/button.html index 639e8d0..b9b5c5e 100644 --- a/dist/button.html +++ b/dist/button.html @@ -1158,6 +1158,8 @@ metisButton(); }); + + diff --git a/dist/calendar.html b/dist/calendar.html index b87bd1f..58158fe 100644 --- a/dist/calendar.html +++ b/dist/calendar.html @@ -316,6 +316,8 @@ metisCalendar(); }); + + diff --git a/dist/chart.html b/dist/chart.html index 8427ffb..d4142ad 100644 --- a/dist/chart.html +++ b/dist/chart.html @@ -289,6 +289,8 @@ metisChart(); }); + + diff --git a/dist/dashboard.html b/dist/dashboard.html index 39d358f..a72b51c 100644 --- a/dist/dashboard.html +++ b/dist/dashboard.html @@ -414,6 +414,8 @@ dashboard(); }); + + diff --git a/dist/file.html b/dist/file.html index 7e4a535..d4829ee 100644 --- a/dist/file.html +++ b/dist/file.html @@ -264,6 +264,8 @@ metisFile(); }); + + diff --git a/dist/form-general.html b/dist/form-general.html index 4330850..906da16 100644 --- a/dist/form-general.html +++ b/dist/form-general.html @@ -1900,6 +1900,8 @@ formGeneral(); }); + + diff --git a/dist/form-validation.html b/dist/form-validation.html index 6b4ded8..3e5eb1c 100644 --- a/dist/form-validation.html +++ b/dist/form-validation.html @@ -567,6 +567,8 @@ formValidation(); }); + + diff --git a/dist/form-wizard.html b/dist/form-wizard.html index d1baae0..6f54c26 100644 --- a/dist/form-wizard.html +++ b/dist/form-wizard.html @@ -569,6 +569,8 @@ formWizard(); }); + + diff --git a/dist/form-wysiwyg.html b/dist/form-wysiwyg.html index 4cd8af0..4ef96a8 100644 --- a/dist/form-wysiwyg.html +++ b/dist/form-wysiwyg.html @@ -379,6 +379,8 @@ formWysiwyg(); }); + + diff --git a/dist/grid.html b/dist/grid.html index 6565dc7..1877321 100644 --- a/dist/grid.html +++ b/dist/grid.html @@ -444,6 +444,8 @@ metisSortable(); }); + + diff --git a/dist/icon.html b/dist/icon.html index 3373b25..636c161 100644 --- a/dist/icon.html +++ b/dist/icon.html @@ -1948,6 +1948,8 @@ + + diff --git a/dist/index.html b/dist/index.html index 12be0a5..64f4bf8 100644 --- a/dist/index.html +++ b/dist/index.html @@ -242,6 +242,8 @@ + + diff --git a/dist/interstitials.html b/dist/interstitials.html index 6faff5e..be960ea 100644 --- a/dist/interstitials.html +++ b/dist/interstitials.html @@ -296,6 +296,8 @@ formWizard(); }); + + diff --git a/dist/login.html b/dist/login.html index 67ee6e4..a001a22 100644 --- a/dist/login.html +++ b/dist/login.html @@ -35,12 +35,12 @@

Enter your AWS Access Key ID and password

- - - + + +
@@ -48,6 +48,7 @@ + diff --git a/dist/maps.html b/dist/maps.html index 9c96aed..2608735 100644 --- a/dist/maps.html +++ b/dist/maps.html @@ -362,6 +362,8 @@ metisMaps(); }); + + diff --git a/dist/panel.html b/dist/panel.html index ae5dbda..59870b6 100644 --- a/dist/panel.html +++ b/dist/panel.html @@ -261,6 +261,8 @@ + + diff --git a/dist/pricing.html b/dist/pricing.html index 52c47f3..4784716 100644 --- a/dist/pricing.html +++ b/dist/pricing.html @@ -460,6 +460,8 @@ metisPricing(); }); + + diff --git a/dist/progress.html b/dist/progress.html index de99bdf..297f2e3 100644 --- a/dist/progress.html +++ b/dist/progress.html @@ -464,6 +464,8 @@ progRess(); }); + + diff --git a/dist/push.html b/dist/push.html index 1699834..cb18161 100644 --- a/dist/push.html +++ b/dist/push.html @@ -293,6 +293,8 @@ formGeneral(); }); + + diff --git a/dist/table.html b/dist/table.html index bb6554f..f7b03f4 100644 --- a/dist/table.html +++ b/dist/table.html @@ -1046,6 +1046,8 @@ metisSortable(); }); + + diff --git a/src/assets/js/app/auth.js b/src/assets/js/app/auth.js new file mode 100644 index 0000000..f963bd2 --- /dev/null +++ b/src/assets/js/app/auth.js @@ -0,0 +1,48 @@ +$(function () { + "use strict"; + + // define storages + var ns = $.initNamespaceStorage('auth'), + local = ns.localStorage, + session = ns.sessionStorage; + + // submitted? + var submitkeys = ['submit_key','submit_secret','submit_dir']; + if (session.isSet(submitkeys)) { + + // check AWS + AWS.config.region = 'eu-west-1'; + AWS.config.update({ + accessKeyId: session.get('submit_key'), + secretAccessKey: session.get('submit_secret') + }); + var s3 = new AWS.S3({params: {Bucket: 'librelio-europe'}}); + s3.listObjects(function(error,data) { + if (error === null) { + console.log(data); + } else { + console.log(error); + } + }) + + // clear submitted data + //session.remove(submitkeys); + } + + // check authentication + var storage = (local.get('remember') === true) ? local : session; + if (!storage.isSet(['key','secret','dir'])) { + //location.href = 'login.html'; + + } + /* + var key = storage.get('key'), + secret = storage.get('secret'), + dir = storage.get('dir'); + + if () + */ + + //ns.localStorage.set('remember', true); +}); + diff --git a/src/assets/lib/jquery-storage-api b/src/assets/lib/jquery-storage-api new file mode 160000 index 0000000..2adb1db --- /dev/null +++ b/src/assets/lib/jquery-storage-api @@ -0,0 +1 @@ +Subproject commit 2adb1db906e2bb51ecea7f5c9a6adc5a938c22af diff --git a/src/templates/layouts/default.hbs b/src/templates/layouts/default.hbs index 08334d6..038f02b 100644 --- a/src/templates/layouts/default.hbs +++ b/src/templates/layouts/default.hbs @@ -186,6 +186,8 @@ {{/if}} + + diff --git a/src/templates/layouts/login.hbs b/src/templates/layouts/login.hbs index 37a3240..ec092f0 100644 --- a/src/templates/layouts/login.hbs +++ b/src/templates/layouts/login.hbs @@ -28,6 +28,7 @@ m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) + diff --git a/src/templates/login/login.hbs b/src/templates/login/login.hbs index 6ef8bc5..3a8e85d 100644 --- a/src/templates/login/login.hbs +++ b/src/templates/login/login.hbs @@ -11,12 +11,12 @@ title: Login Page

Enter your AWS Access Key ID and password

- - - + + +
From 1691992c7f3836d0b0afa923a5c65c4e90b5fb07 Mon Sep 17 00:00:00 2001 From: Richard Ruiter Date: Thu, 10 Apr 2014 12:21:33 +0000 Subject: [PATCH 2/4] #1 finished authentication --- dist/assets/js/main.js | 84 ++++++++++++++++++++------------- dist/assets/js/main.min.js | 2 +- dist/login.html | 2 +- src/assets/js/app/auth.js | 84 ++++++++++++++++++++------------- src/templates/layouts/login.hbs | 2 +- 5 files changed, 107 insertions(+), 67 deletions(-) diff --git a/dist/assets/js/main.js b/dist/assets/js/main.js index 9642808..2aa7056 100644 --- a/dist/assets/js/main.js +++ b/dist/assets/js/main.js @@ -10,46 +10,66 @@ $(function () { // define storages var ns = $.initNamespaceStorage('auth'), local = ns.localStorage, - session = ns.sessionStorage; - + session = ns.sessionStorage, + storage = (local.get('remember') === true) ? local : session, + authkeys = ['key', 'secret', 'dir', 'authvalid'], + submitkeys = ['submit_key','submit_secret','submit_dir']; + + // callback for validation + var checkAuth = function() { + // check authentication + if (!storage.isSet(authkeys) && storage.get('authvalid') !== true) { + location.href = 'login.html'; + } + } + // submitted? - var submitkeys = ['submit_key','submit_secret','submit_dir']; if (session.isSet(submitkeys)) { + + // define parameters + var bucket = 'librelio-europe', + key = session.get('submit_key'), + secret = session.get('submit_secret'), + dir = session.get('submit_dir'); - // check AWS + // setup AWS AWS.config.region = 'eu-west-1'; AWS.config.update({ - accessKeyId: session.get('submit_key'), - secretAccessKey: session.get('submit_secret') + accessKeyId: key, + secretAccessKey: secret }); - var s3 = new AWS.S3({params: {Bucket: 'librelio-europe'}}); - s3.listObjects(function(error,data) { - if (error === null) { - console.log(data); - } else { - console.log(error); - } - }) - + + // check auth + directory + var s3 = new AWS.S3({ region: AWS.config.region, maxRetries: 1 }); + s3.listObjects({Bucket: bucket, Prefix: dir + "/", MaxKeys: 1}, function(error,data) { + data.Contents = data.Contents || []; + if (error === null && data.Contents.length > 0) { + storage.set('key', key); + storage.set('secret', secret); + storage.set('dir', dir); + storage.set('authvalid', true); + } else { + alert("Couldn't connect to aws s3: " + err); + } + + // check the authentication + checkAuth(); + }); + // clear submitted data - //session.remove(submitkeys); + session.remove(submitkeys); } - - // check authentication - var storage = (local.get('remember') === true) ? local : session; - if (!storage.isSet(['key','secret','dir'])) { - //location.href = 'login.html'; - - } - /* - var key = storage.get('key'), - secret = storage.get('secret'), - dir = storage.get('dir'); - - if () - */ - - //ns.localStorage.set('remember', true); + else { + // check the authentication + checkAuth(); + } + + // logout button + $('.fa-power-off').click(function() { + $.removeAllStorages(); + checkAuth(); + return false; + }); }); diff --git a/dist/assets/js/main.min.js b/dist/assets/js/main.min.js index a281116..1eed67f 100644 --- a/dist/assets/js/main.min.js +++ b/dist/assets/js/main.min.js @@ -4,4 +4,4 @@ * Copyright 2014 * Licensed under MIT */ -function metisButton(){window.prettyPrint&&prettyPrint(),$.each($(".inner a.btn"),function(){$(this).popover({placement:"bottom",title:this.innerHTML,content:this.outerHTML,trigger:"hover"})})}function metisChart(){"use strict";function a(a){return Math.sqrt(2)*Math.cos(a)/(Math.pow(Math.sin(a),2)+1)}function b(a){return Math.sqrt(2)*Math.cos(a)*Math.sin(a)/(Math.pow(Math.sin(a),2)+1)}var c=[[0,3],[1,8],[2,5],[3,13],[4,1]],d=[[0,12],[2,2],[3,9],[4,4]];$.plot($("#trigo"),[{data:c,label:"MAN"},{data:d,label:"WOMAN"}],{clickable:!0,hoverable:!0,series:{lines:{show:!0,fill:!0,fillColor:{colors:[{opacity:.5},{opacity:.15}]}},points:{show:!0}}}),$.plot($("#trigo2"),[{data:c,label:"BAR"}],{clickable:!0,hoverable:!0,series:{bars:{show:!0,barWidth:.6},points:{show:!0}}});for(var e=[],f=[],g=-5;5>=g;g+=.5)e.push([g,Math.pow(g,2)-25]),f.push([g,-Math.pow(g,2)+25]);for(var h=[],i=-2;2.1>=i;i+=.1)h.push([i,Math.sqrt(400-i*i*100)]),h.push([i,-Math.sqrt(400-i*i*100)]);$.plot($("#eye"),[{data:f,lines:{show:!0,fill:!0}},{data:e,lines:{show:!0,fill:!0}},{data:h,lines:{show:!0}}]);var j=[];for(g=-2;5>=g;g+=.01)j.push([16*Math.pow(Math.sin(g),3),13*Math.cos(g)-5*Math.cos(2*g)-2*Math.cos(3*g)-Math.cos(4*g)]);$.plot($("#heart"),[{data:j,label:'',color:"#9A004D"}],{series:{lines:{show:!0,fill:!0},points:{show:!1}},yaxis:{show:!0},xaxis:{show:!0}}),$("#heart .legendLabel").addClass("animated pulse"),setInterval(function(){$("#heart .legendLabel .fa.fa-heart").toggleClass("fa-2x")},400);for(var k=[],l=0;l<=2*Math.PI;l+=.01)k.push([a(l),b(l)]);$.plot($("#bernoilli"),[{data:k,label:"Lemniscate of Bernoulli",lines:{show:!0,fill:!0}}])}function dashboard(){"use strict";function a(a,b,c){$('
'+c+"
").css({position:"absolute",display:"none",top:b+5,left:a+5,border:"1px solid #fdd",padding:"2px","background-color":"#000",color:"#fff"}).appendTo("body").fadeIn(200)}$(".inlinesparkline").sparkline();var b=[10,8,5,7,4,4,1];$(".dynamicsparkline").sparkline(b),$(".dynamicbar").sparkline(b,{type:"bar",barColor:"green"}),$(".inlinebar").sparkline("html",{type:"bar",barColor:"red"}),$(".sparkline.bar_week").sparkline([5,6,7,2,0,-4,-2,4],{type:"bar",height:"40",barWidth:5,barColor:"#4d6189",negBarColor:"#a20051"}),$(".sparkline.line_day").sparkline([5,6,7,9,9,5,4,6,6,4,6,7],{type:"line",height:"40",drawNormalOnTop:!1}),$(".sparkline.pie_week").sparkline([1,1,2],{type:"pie",width:"40",height:"40"}),$(".sparkline.stacked_month").sparkline(["0:2","2:4","4:2","4:1"],{type:"bar",height:"40",barWidth:10,barColor:"#4d6189",negBarColor:"#a20051"});for(var c=new Date,d=c.getDate(),e=c.getMonth(),f=c.getFullYear(),g=$("#calendar").fullCalendar({header:{left:"prev,today,next,",center:"title",right:"month,agendaWeek,agendaDay"},selectable:!0,selectHelper:!0,select:function(a,b,c){var d=prompt("Event Title:");d&&g.fullCalendar("renderEvent",{title:d,start:a,end:b,allDay:c},!0),g.fullCalendar("unselect")},editable:!0,events:[{title:"All Day Event",start:new Date(f,e,1),className:"label label-success"},{title:"Long Event",start:new Date(f,e,d-5),end:new Date(f,e,d-2),className:"label label-info"},{id:999,title:"Repeating Event",start:new Date(f,e,d-3,16,0),allDay:!1,className:"label label-warning"},{id:999,title:"Repeating Event",start:new Date(f,e,d+4,16,0),allDay:!1,className:"label label-inverse"},{title:"Meeting",start:new Date(f,e,d,10,30),allDay:!1,className:"label label-important"},{title:"Lunch",start:new Date(f,e,d,12,0),end:new Date(f,e,d,14,0),allDay:!1},{title:"Birthday Party",start:new Date(f,e,d+1,19,0),end:new Date(f,e,d+1,22,30),allDay:!1},{title:"Click for Google",start:new Date(f,e,28),end:new Date(f,e,29),url:"http://google.com/"}]}),h=[],i=[],j=0;14>j;j+=.5)h.push([j,Math.sin(j)]),i.push([j,Math.cos(j)]);var k=($.plot($("#trigo"),[{data:h,label:"sin(x)",points:{fillColor:"#4572A7",size:5},color:"#4572A7"},{data:i,label:"cos(x)",points:{fillColor:"#333",size:35},color:"#AA4643"}],{series:{lines:{show:!0},points:{show:!0}},grid:{hoverable:!0,clickable:!0},yaxis:{min:-1.2,max:1.2}}),null);$("#trigo").bind("plothover",function(b,c,d){if($("#x").text(c.x.toFixed(2)),$("#y").text(c.y.toFixed(2)),d){if(k!==d.dataIndex){k=d.dataIndex,$("#tooltip").remove();var e=d.datapoint[0].toFixed(2),f=d.datapoint[1].toFixed(2);a(d.pageX,d.pageY,d.series.label+" of "+e+" = "+f)}}else $("#tooltip").remove(),k=null}),$(".sortableTable").tablesorter()}function formGeneral(){"use strict";$(".with-tooltip").tooltip({selector:".input-tooltip"}),$("#autosize").autosize(),$("#limiter").inputlimiter({limit:140,remText:"You only have %n character%s remaining...",limitText:"You're allowed to input %n character%s into this field."}),$("#tags").tagsInput(),$(".chzn-select").chosen(),$(".chzn-select-deselect").chosen({allow_single_deselect:!0}),$(".uniform").uniform(),$("#validVal").validVal(),$("#cp1").colorpicker({format:"hex"}),$("#cp2").colorpicker(),$("#cp3").colorpicker(),$("#cp4").colorpicker().on("changeColor",function(a){$("#colorPickerBlock").css("background-color",a.color.toHex())}),$("#dp1").datepicker({format:"mm-dd-yyyy"}),$("#dp2").datepicker(),$("#dp3").datepicker(),$("#dp3").datepicker(),$("#dpYears").datepicker(),$("#dpMonths").datepicker();var a=new Date(2014,1,20),b=new Date(2014,1,25);$("#dp4").datepicker().on("changeDate",function(c){c.date.valueOf()>b.valueOf()?$("#alert").show().find("strong").text("The start date can not be greater then the end date"):($("#alert").hide(),a=new Date(c.date),$("#startDate").text($("#dp4").data("date"))),$("#dp4").datepicker("hide")}),$("#dp5").datepicker().on("changeDate",function(c){c.date.valueOf()'+a+"");jQuery("#external-events").append(d),c(d)};$("#external-events li.external-event").each(function(){c($(this))}),$("#add-event").click(function(){var a=$("#title").val(),b=$("input:radio[name=priority]:checked").val();d(a,b)}),$("#calendar").fullCalendar({header:b,buttonText:{prev:'',next:''},editable:!0,droppable:!0,drop:function(a,b){var c=$(this).data("eventObject"),d=$.extend({},c);d.start=a,d.allDay=b,$("#calendar").fullCalendar("renderEvent",d,!0),$("#drop-remove").is(":checked")&&$(this).remove()},windowResize:function(){$("#calendar").fullCalendar("render")}})}function metisFile(){"use strict";$("#elfinder").elfinder({url:"assets/elfinder-2.0-rc1/php/connector.php"}).elfinder("instance")}function metisMaps(){"use strict";var a,b,c,d,e,f,g;a=new GMaps({el:"#gmaps-basic",lat:-12.043333,lng:-77.028333,zoomControl:!0,zoomControlOpt:{style:"SMALL",position:"TOP_LEFT"},panControl:!1,streetViewControl:!1,mapTypeControl:!1,overviewMapControl:!1}),b=new GMaps({el:"#gmaps-marker",lat:-12.043333,lng:-77.028333}),b.addMarker({lat:-12.043333,lng:-77.03,title:"Lima",details:{database_id:42,author:"HPNeo"},click:function(a){console.log&&console.log(a),alert("You clicked in this marker")},mouseover:function(a){console.log&&console.log(a)}}),b.addMarker({lat:-12.042,lng:-77.028333,title:"Marker with InfoWindow",infoWindow:{content:"

HTML Content

"}}),c=new GMaps({el:"#gmaps-geolocation",lat:-12.043333,lng:-77.028333}),GMaps.geolocate({success:function(a){c.setCenter(a.coords.latitude,a.coords.longitude)},error:function(a){alert("Geolocation failed: "+a.message)},not_supported:function(){alert("Your browser does not support geolocation")},always:function(){}}),d=new GMaps({el:"#gmaps-polylines",lat:-12.043333,lng:-77.028333,click:function(a){console.log(a)}}),f=[[-12.044012922866312,-77.02470665341184],[-12.05449279282314,-77.03024273281858],[-12.055122327623378,-77.03039293652341],[-12.075917129727586,-77.02764635449216],[-12.07635776902266,-77.02792530422971],[-12.076819390363665,-77.02893381481931],[-12.088527520066453,-77.0241058385925],[-12.090814532191756,-77.02271108990476]],d.drawPolyline({path:f,strokeColor:"#131540",strokeOpacity:.6,strokeWeight:6}),e=new GMaps({el:"#gmaps-route",lat:-12.043333,lng:-77.028333}),e.drawRoute({origin:[-12.044012922866312,-77.02470665341184],destination:[-12.090814532191756,-77.02271108990476],travelMode:"driving",strokeColor:"#131540",strokeOpacity:.6,strokeWeight:6}),g=new GMaps({el:"#gmaps-geocoding",lat:-12.043333,lng:-77.028333}),$("#geocoding_form").submit(function(a){a.preventDefault(),GMaps.geocode({address:$("#address").val().trim(),callback:function(a,b){if("OK"===b){var c=a[0].geometry.location;g.setCenter(c.lat(),c.lng()),g.addMarker({lat:c.lat(),lng:c.lng()})}}})})}function metisSortable(){$(".inner .row").sortable({})}function metisTable(){"use strict";$(".sortableTable").tablesorter(),$("#dataTable").dataTable({sDom:"<'pull-right'l>t<'row'<'col-lg-6'f><'col-lg-6'p>>",sPaginationType:"bootstrap",oLanguage:{sLengthMenu:"Show _MENU_ entries"}}),$("#actionTable button.remove").on("click",function(){$(this).closest("tr").remove()}),$("#actionTable button.edit").on("click",function(){$("#editModal").modal({show:!0});var a=$(this).closest("tr").children("td").eq(1),b=$(this).closest("tr").children("td").eq(2),c=$(this).closest("tr").children("td").eq(3);$("#editModal #fName").val(a.html()),$("#editModal #lName").val(b.html()),$("#editModal #uName").val(c.html()),$("#editModal #sbmtBtn").on("click",function(){a.html($("#editModal #fName").val()),b.html($("#editModal #lName").val()),c.html($("#editModal #uName").val())})})}function metisPricing(){$("#dark-toggle label").on("click",function(){var a=$(this);$("ul.dark li.active").removeClass("primary success danger warning info default").addClass(a.find("input").val())}),$("#light-toggle label").on("click",function(){var a=$(this);$("ul#light li.active").removeClass("primary success danger warning info default").addClass(a.find("input").val())})}function progRess(){window.prettyPrint&&prettyPrint(),$.each($(".progress .progress-bar"),function(){$(this).animate({width:$(this).attr("aria-valuenow")+"%"}),$(this).popover({placement:"bottom",title:"Source",content:this.outerHTML})})}$(function(){"use strict";var a=$.initNamespaceStorage("auth"),b=a.localStorage,c=a.sessionStorage,d=["submit_key","submit_secret","submit_dir"];if(c.isSet(d)){AWS.config.region="eu-west-1",AWS.config.update({accessKeyId:c.get("submit_key"),secretAccessKey:c.get("submit_secret")});var e=new AWS.S3({params:{Bucket:"librelio-europe"}});e.listObjects(function(a,b){console.log(null===a?b:a)})}var f=b.get("remember")===!0?b:c;!f.isSet(["key","secret","dir"])}),$(function(){"use strict";$("a[href=#]").on("click",function(a){a.preventDefault()}),$("a[data-toggle=tooltip]").tooltip(),$("a[data-tooltip=tooltip]").tooltip(),$(".minimize-box").on("click",function(a){a.preventDefault();var b=$(this).children("i");b.hasClass("icon-chevron-down")?b.removeClass("icon-chevron-down").addClass("icon-chevron-up"):b.hasClass("icon-chevron-up")&&b.removeClass("icon-chevron-up").addClass("icon-chevron-down")}),$(".close-box").click(function(){$(this).closest(".box").hide("slow")}),$("#changeSidebarPos").on("click",function(){$("body").toggleClass("hide-sidebar")}),$("li.accordion-group > a").on("click",function(){$(this).children("span").children("i").toggleClass("icon-angle-down")}),$("#menu-toggle").on("click",function(a){$("#left").toggleClass("opened"),a.preventDefault()}),$("#menu").metisMenu()});var toggleFullScreen={init:function(){void 0!==window.screenfull&&screenfull.enabled?$("#toggleFullScreen").on("click",function(a){screenfull.toggle(window.document[0]),$("body").toggleClass("fullScreen"),a.preventDefault()}):$("#toggleFullScreen").addClass("hidden")}};toggleFullScreen.init();var boxFullScreen={init:function(){void 0!==window.screenfull&&screenfull.enabled?$(".full-box").on("click",function(a){var b=$(this).parents(".box")[0];screenfull.toggle(b),$(this).parents(".box").toggleClass("full-screen-box"),$(this).parents(".box").children(".body").toggleClass("full-screen-box"),$(this).children("i").toggleClass("fa-compress"),a.preventDefault()}):$(".full-box").addClass("hidden")}};boxFullScreen.init();var panelBodyCollapse={init:function(){var a=$(".collapse-box"),b=a.closest(".box").children(".body");b.collapse("show"),a.on("click",function(a){var b=$(this).closest(".box").children(".body"),c=$(this).children("i");b.on("show.bs.collapse",function(){c.removeClass("fa-minus fa-plus").addClass("fa-spinner fa-spin")}),b.on("shown.bs.collapse",function(){c.removeClass("fa-spinner fa-spin").addClass("fa-minus")}),b.on("hide.bs.collapse",function(){c.removeClass("fa-minus fa-plus").addClass("fa-spinner fa-spin")}),b.on("hidden.bs.collapse",function(){c.removeClass("fa-spinner fa-spin").addClass("fa-plus")}),b.collapse("toggle"),a.preventDefault()})}};panelBodyCollapse.init();var boxHiding={init:function(){$(".close-box").click(function(){$(this).closest(".box").hide("slow")})}};boxHiding.init(),function(a,b){function c(b,c){this.element=b,this.settings=a.extend({},e,c),this._defaults=e,this._name=d,this.init()}var d="metisMenu",e={toggle:!0,hidingClass:"u-isHiddenVisually"};c.prototype={init:function(){function c(){a("body").removeClass("mini-sidebar"),g.find("li.active").has("ul").children("ul").addClass("collapse in"),g.find("li").not(".active").has("ul").children("ul").addClass("collapse"),g.find("li").has("ul").children("a").on("click",function(b){b.preventDefault(),a(this).parent("li").toggleClass("opened").children("ul").collapse("toggle"),h&&a(this).parent("li").siblings().removeClass("opened").children("ul.in").collapse("hide")})}function d(){g.find("li").has("ul").children("ul").removeClass("collapse in").css("height","inherit"),g.hasClass("affix")||g.find("li").has("ul").children("a").off("click")}function e(){a(b).width()<992?c():d()}{var f,g=a(this.element),h=this.settings.toggle;this.settings.hidingClass}e(),g.on("affix.bs.affix",function(){console.log("affix.bs.affix")}),g.on("affix-top.bs.affix",function(){console.log("affix-top.bs.affix")}),g.on("affixed.bs.affix",function(){c(),console.log("affixed.bs.affix")}),g.on("affixed-top.bs.affix",function(){d(),console.log("affixed-top.bs.affix")}),a(b).resize(function(){clearTimeout(f),f=setTimeout(e,250)})}},a.fn[d]=function(b){return this.each(function(){a.data(this,"plugin_"+d)||a.data(this,"plugin_"+d,new c(this,b))})}}(jQuery,window,document); \ No newline at end of file +function metisButton(){window.prettyPrint&&prettyPrint(),$.each($(".inner a.btn"),function(){$(this).popover({placement:"bottom",title:this.innerHTML,content:this.outerHTML,trigger:"hover"})})}function metisChart(){"use strict";function a(a){return Math.sqrt(2)*Math.cos(a)/(Math.pow(Math.sin(a),2)+1)}function b(a){return Math.sqrt(2)*Math.cos(a)*Math.sin(a)/(Math.pow(Math.sin(a),2)+1)}var c=[[0,3],[1,8],[2,5],[3,13],[4,1]],d=[[0,12],[2,2],[3,9],[4,4]];$.plot($("#trigo"),[{data:c,label:"MAN"},{data:d,label:"WOMAN"}],{clickable:!0,hoverable:!0,series:{lines:{show:!0,fill:!0,fillColor:{colors:[{opacity:.5},{opacity:.15}]}},points:{show:!0}}}),$.plot($("#trigo2"),[{data:c,label:"BAR"}],{clickable:!0,hoverable:!0,series:{bars:{show:!0,barWidth:.6},points:{show:!0}}});for(var e=[],f=[],g=-5;5>=g;g+=.5)e.push([g,Math.pow(g,2)-25]),f.push([g,-Math.pow(g,2)+25]);for(var h=[],i=-2;2.1>=i;i+=.1)h.push([i,Math.sqrt(400-i*i*100)]),h.push([i,-Math.sqrt(400-i*i*100)]);$.plot($("#eye"),[{data:f,lines:{show:!0,fill:!0}},{data:e,lines:{show:!0,fill:!0}},{data:h,lines:{show:!0}}]);var j=[];for(g=-2;5>=g;g+=.01)j.push([16*Math.pow(Math.sin(g),3),13*Math.cos(g)-5*Math.cos(2*g)-2*Math.cos(3*g)-Math.cos(4*g)]);$.plot($("#heart"),[{data:j,label:'',color:"#9A004D"}],{series:{lines:{show:!0,fill:!0},points:{show:!1}},yaxis:{show:!0},xaxis:{show:!0}}),$("#heart .legendLabel").addClass("animated pulse"),setInterval(function(){$("#heart .legendLabel .fa.fa-heart").toggleClass("fa-2x")},400);for(var k=[],l=0;l<=2*Math.PI;l+=.01)k.push([a(l),b(l)]);$.plot($("#bernoilli"),[{data:k,label:"Lemniscate of Bernoulli",lines:{show:!0,fill:!0}}])}function dashboard(){"use strict";function a(a,b,c){$('
'+c+"
").css({position:"absolute",display:"none",top:b+5,left:a+5,border:"1px solid #fdd",padding:"2px","background-color":"#000",color:"#fff"}).appendTo("body").fadeIn(200)}$(".inlinesparkline").sparkline();var b=[10,8,5,7,4,4,1];$(".dynamicsparkline").sparkline(b),$(".dynamicbar").sparkline(b,{type:"bar",barColor:"green"}),$(".inlinebar").sparkline("html",{type:"bar",barColor:"red"}),$(".sparkline.bar_week").sparkline([5,6,7,2,0,-4,-2,4],{type:"bar",height:"40",barWidth:5,barColor:"#4d6189",negBarColor:"#a20051"}),$(".sparkline.line_day").sparkline([5,6,7,9,9,5,4,6,6,4,6,7],{type:"line",height:"40",drawNormalOnTop:!1}),$(".sparkline.pie_week").sparkline([1,1,2],{type:"pie",width:"40",height:"40"}),$(".sparkline.stacked_month").sparkline(["0:2","2:4","4:2","4:1"],{type:"bar",height:"40",barWidth:10,barColor:"#4d6189",negBarColor:"#a20051"});for(var c=new Date,d=c.getDate(),e=c.getMonth(),f=c.getFullYear(),g=$("#calendar").fullCalendar({header:{left:"prev,today,next,",center:"title",right:"month,agendaWeek,agendaDay"},selectable:!0,selectHelper:!0,select:function(a,b,c){var d=prompt("Event Title:");d&&g.fullCalendar("renderEvent",{title:d,start:a,end:b,allDay:c},!0),g.fullCalendar("unselect")},editable:!0,events:[{title:"All Day Event",start:new Date(f,e,1),className:"label label-success"},{title:"Long Event",start:new Date(f,e,d-5),end:new Date(f,e,d-2),className:"label label-info"},{id:999,title:"Repeating Event",start:new Date(f,e,d-3,16,0),allDay:!1,className:"label label-warning"},{id:999,title:"Repeating Event",start:new Date(f,e,d+4,16,0),allDay:!1,className:"label label-inverse"},{title:"Meeting",start:new Date(f,e,d,10,30),allDay:!1,className:"label label-important"},{title:"Lunch",start:new Date(f,e,d,12,0),end:new Date(f,e,d,14,0),allDay:!1},{title:"Birthday Party",start:new Date(f,e,d+1,19,0),end:new Date(f,e,d+1,22,30),allDay:!1},{title:"Click for Google",start:new Date(f,e,28),end:new Date(f,e,29),url:"http://google.com/"}]}),h=[],i=[],j=0;14>j;j+=.5)h.push([j,Math.sin(j)]),i.push([j,Math.cos(j)]);var k=($.plot($("#trigo"),[{data:h,label:"sin(x)",points:{fillColor:"#4572A7",size:5},color:"#4572A7"},{data:i,label:"cos(x)",points:{fillColor:"#333",size:35},color:"#AA4643"}],{series:{lines:{show:!0},points:{show:!0}},grid:{hoverable:!0,clickable:!0},yaxis:{min:-1.2,max:1.2}}),null);$("#trigo").bind("plothover",function(b,c,d){if($("#x").text(c.x.toFixed(2)),$("#y").text(c.y.toFixed(2)),d){if(k!==d.dataIndex){k=d.dataIndex,$("#tooltip").remove();var e=d.datapoint[0].toFixed(2),f=d.datapoint[1].toFixed(2);a(d.pageX,d.pageY,d.series.label+" of "+e+" = "+f)}}else $("#tooltip").remove(),k=null}),$(".sortableTable").tablesorter()}function formGeneral(){"use strict";$(".with-tooltip").tooltip({selector:".input-tooltip"}),$("#autosize").autosize(),$("#limiter").inputlimiter({limit:140,remText:"You only have %n character%s remaining...",limitText:"You're allowed to input %n character%s into this field."}),$("#tags").tagsInput(),$(".chzn-select").chosen(),$(".chzn-select-deselect").chosen({allow_single_deselect:!0}),$(".uniform").uniform(),$("#validVal").validVal(),$("#cp1").colorpicker({format:"hex"}),$("#cp2").colorpicker(),$("#cp3").colorpicker(),$("#cp4").colorpicker().on("changeColor",function(a){$("#colorPickerBlock").css("background-color",a.color.toHex())}),$("#dp1").datepicker({format:"mm-dd-yyyy"}),$("#dp2").datepicker(),$("#dp3").datepicker(),$("#dp3").datepicker(),$("#dpYears").datepicker(),$("#dpMonths").datepicker();var a=new Date(2014,1,20),b=new Date(2014,1,25);$("#dp4").datepicker().on("changeDate",function(c){c.date.valueOf()>b.valueOf()?$("#alert").show().find("strong").text("The start date can not be greater then the end date"):($("#alert").hide(),a=new Date(c.date),$("#startDate").text($("#dp4").data("date"))),$("#dp4").datepicker("hide")}),$("#dp5").datepicker().on("changeDate",function(c){c.date.valueOf()'+a+"");jQuery("#external-events").append(d),c(d)};$("#external-events li.external-event").each(function(){c($(this))}),$("#add-event").click(function(){var a=$("#title").val(),b=$("input:radio[name=priority]:checked").val();d(a,b)}),$("#calendar").fullCalendar({header:b,buttonText:{prev:'',next:''},editable:!0,droppable:!0,drop:function(a,b){var c=$(this).data("eventObject"),d=$.extend({},c);d.start=a,d.allDay=b,$("#calendar").fullCalendar("renderEvent",d,!0),$("#drop-remove").is(":checked")&&$(this).remove()},windowResize:function(){$("#calendar").fullCalendar("render")}})}function metisFile(){"use strict";$("#elfinder").elfinder({url:"assets/elfinder-2.0-rc1/php/connector.php"}).elfinder("instance")}function metisMaps(){"use strict";var a,b,c,d,e,f,g;a=new GMaps({el:"#gmaps-basic",lat:-12.043333,lng:-77.028333,zoomControl:!0,zoomControlOpt:{style:"SMALL",position:"TOP_LEFT"},panControl:!1,streetViewControl:!1,mapTypeControl:!1,overviewMapControl:!1}),b=new GMaps({el:"#gmaps-marker",lat:-12.043333,lng:-77.028333}),b.addMarker({lat:-12.043333,lng:-77.03,title:"Lima",details:{database_id:42,author:"HPNeo"},click:function(a){console.log&&console.log(a),alert("You clicked in this marker")},mouseover:function(a){console.log&&console.log(a)}}),b.addMarker({lat:-12.042,lng:-77.028333,title:"Marker with InfoWindow",infoWindow:{content:"

HTML Content

"}}),c=new GMaps({el:"#gmaps-geolocation",lat:-12.043333,lng:-77.028333}),GMaps.geolocate({success:function(a){c.setCenter(a.coords.latitude,a.coords.longitude)},error:function(a){alert("Geolocation failed: "+a.message)},not_supported:function(){alert("Your browser does not support geolocation")},always:function(){}}),d=new GMaps({el:"#gmaps-polylines",lat:-12.043333,lng:-77.028333,click:function(a){console.log(a)}}),f=[[-12.044012922866312,-77.02470665341184],[-12.05449279282314,-77.03024273281858],[-12.055122327623378,-77.03039293652341],[-12.075917129727586,-77.02764635449216],[-12.07635776902266,-77.02792530422971],[-12.076819390363665,-77.02893381481931],[-12.088527520066453,-77.0241058385925],[-12.090814532191756,-77.02271108990476]],d.drawPolyline({path:f,strokeColor:"#131540",strokeOpacity:.6,strokeWeight:6}),e=new GMaps({el:"#gmaps-route",lat:-12.043333,lng:-77.028333}),e.drawRoute({origin:[-12.044012922866312,-77.02470665341184],destination:[-12.090814532191756,-77.02271108990476],travelMode:"driving",strokeColor:"#131540",strokeOpacity:.6,strokeWeight:6}),g=new GMaps({el:"#gmaps-geocoding",lat:-12.043333,lng:-77.028333}),$("#geocoding_form").submit(function(a){a.preventDefault(),GMaps.geocode({address:$("#address").val().trim(),callback:function(a,b){if("OK"===b){var c=a[0].geometry.location;g.setCenter(c.lat(),c.lng()),g.addMarker({lat:c.lat(),lng:c.lng()})}}})})}function metisSortable(){$(".inner .row").sortable({})}function metisTable(){"use strict";$(".sortableTable").tablesorter(),$("#dataTable").dataTable({sDom:"<'pull-right'l>t<'row'<'col-lg-6'f><'col-lg-6'p>>",sPaginationType:"bootstrap",oLanguage:{sLengthMenu:"Show _MENU_ entries"}}),$("#actionTable button.remove").on("click",function(){$(this).closest("tr").remove()}),$("#actionTable button.edit").on("click",function(){$("#editModal").modal({show:!0});var a=$(this).closest("tr").children("td").eq(1),b=$(this).closest("tr").children("td").eq(2),c=$(this).closest("tr").children("td").eq(3);$("#editModal #fName").val(a.html()),$("#editModal #lName").val(b.html()),$("#editModal #uName").val(c.html()),$("#editModal #sbmtBtn").on("click",function(){a.html($("#editModal #fName").val()),b.html($("#editModal #lName").val()),c.html($("#editModal #uName").val())})})}function metisPricing(){$("#dark-toggle label").on("click",function(){var a=$(this);$("ul.dark li.active").removeClass("primary success danger warning info default").addClass(a.find("input").val())}),$("#light-toggle label").on("click",function(){var a=$(this);$("ul#light li.active").removeClass("primary success danger warning info default").addClass(a.find("input").val())})}function progRess(){window.prettyPrint&&prettyPrint(),$.each($(".progress .progress-bar"),function(){$(this).animate({width:$(this).attr("aria-valuenow")+"%"}),$(this).popover({placement:"bottom",title:"Source",content:this.outerHTML})})}$(function(){"use strict";var a=$.initNamespaceStorage("auth"),b=a.localStorage,c=a.sessionStorage,d=b.get("remember")===!0?b:c,e=["key","secret","dir","authvalid"],f=["submit_key","submit_secret","submit_dir"],g=function(){d.isSet(e)||d.get("authvalid")===!0||(location.href="login.html")};if(c.isSet(f)){var h="librelio-europe",i=c.get("submit_key"),j=c.get("submit_secret"),k=c.get("submit_dir");AWS.config.region="eu-west-1",AWS.config.update({accessKeyId:i,secretAccessKey:j});var l=new AWS.S3({region:AWS.config.region,maxRetries:1});l.listObjects({Bucket:h,Prefix:k+"/",MaxKeys:1},function(a,b){b.Contents=b.Contents||[],null===a&&b.Contents.length>0?(d.set("key",i),d.set("secret",j),d.set("dir",k),d.set("authvalid",!0)):alert("Couldn't connect to aws s3: "+err),g()}),c.remove(f)}else g();$(".fa-power-off").click(function(){return $.removeAllStorages(),g(),!1})}),$(function(){"use strict";$("a[href=#]").on("click",function(a){a.preventDefault()}),$("a[data-toggle=tooltip]").tooltip(),$("a[data-tooltip=tooltip]").tooltip(),$(".minimize-box").on("click",function(a){a.preventDefault();var b=$(this).children("i");b.hasClass("icon-chevron-down")?b.removeClass("icon-chevron-down").addClass("icon-chevron-up"):b.hasClass("icon-chevron-up")&&b.removeClass("icon-chevron-up").addClass("icon-chevron-down")}),$(".close-box").click(function(){$(this).closest(".box").hide("slow")}),$("#changeSidebarPos").on("click",function(){$("body").toggleClass("hide-sidebar")}),$("li.accordion-group > a").on("click",function(){$(this).children("span").children("i").toggleClass("icon-angle-down")}),$("#menu-toggle").on("click",function(a){$("#left").toggleClass("opened"),a.preventDefault()}),$("#menu").metisMenu()});var toggleFullScreen={init:function(){void 0!==window.screenfull&&screenfull.enabled?$("#toggleFullScreen").on("click",function(a){screenfull.toggle(window.document[0]),$("body").toggleClass("fullScreen"),a.preventDefault()}):$("#toggleFullScreen").addClass("hidden")}};toggleFullScreen.init();var boxFullScreen={init:function(){void 0!==window.screenfull&&screenfull.enabled?$(".full-box").on("click",function(a){var b=$(this).parents(".box")[0];screenfull.toggle(b),$(this).parents(".box").toggleClass("full-screen-box"),$(this).parents(".box").children(".body").toggleClass("full-screen-box"),$(this).children("i").toggleClass("fa-compress"),a.preventDefault()}):$(".full-box").addClass("hidden")}};boxFullScreen.init();var panelBodyCollapse={init:function(){var a=$(".collapse-box"),b=a.closest(".box").children(".body");b.collapse("show"),a.on("click",function(a){var b=$(this).closest(".box").children(".body"),c=$(this).children("i");b.on("show.bs.collapse",function(){c.removeClass("fa-minus fa-plus").addClass("fa-spinner fa-spin")}),b.on("shown.bs.collapse",function(){c.removeClass("fa-spinner fa-spin").addClass("fa-minus")}),b.on("hide.bs.collapse",function(){c.removeClass("fa-minus fa-plus").addClass("fa-spinner fa-spin")}),b.on("hidden.bs.collapse",function(){c.removeClass("fa-spinner fa-spin").addClass("fa-plus")}),b.collapse("toggle"),a.preventDefault()})}};panelBodyCollapse.init();var boxHiding={init:function(){$(".close-box").click(function(){$(this).closest(".box").hide("slow")})}};boxHiding.init(),function(a,b){function c(b,c){this.element=b,this.settings=a.extend({},e,c),this._defaults=e,this._name=d,this.init()}var d="metisMenu",e={toggle:!0,hidingClass:"u-isHiddenVisually"};c.prototype={init:function(){function c(){a("body").removeClass("mini-sidebar"),g.find("li.active").has("ul").children("ul").addClass("collapse in"),g.find("li").not(".active").has("ul").children("ul").addClass("collapse"),g.find("li").has("ul").children("a").on("click",function(b){b.preventDefault(),a(this).parent("li").toggleClass("opened").children("ul").collapse("toggle"),h&&a(this).parent("li").siblings().removeClass("opened").children("ul.in").collapse("hide")})}function d(){g.find("li").has("ul").children("ul").removeClass("collapse in").css("height","inherit"),g.hasClass("affix")||g.find("li").has("ul").children("a").off("click")}function e(){a(b).width()<992?c():d()}{var f,g=a(this.element),h=this.settings.toggle;this.settings.hidingClass}e(),g.on("affix.bs.affix",function(){console.log("affix.bs.affix")}),g.on("affix-top.bs.affix",function(){console.log("affix-top.bs.affix")}),g.on("affixed.bs.affix",function(){c(),console.log("affixed.bs.affix")}),g.on("affixed-top.bs.affix",function(){d(),console.log("affixed-top.bs.affix")}),a(b).resize(function(){clearTimeout(f),f=setTimeout(e,250)})}},a.fn[d]=function(b){return this.each(function(){a.data(this,"plugin_"+d)||a.data(this,"plugin_"+d,new c(this,b))})}}(jQuery,window,document); \ No newline at end of file diff --git a/dist/login.html b/dist/login.html index a001a22..ff0c055 100644 --- a/dist/login.html +++ b/dist/login.html @@ -66,7 +66,7 @@ ns.sessionStorage.set('submit_key', $('#key').val()); ns.sessionStorage.set('submit_secret', $('#secret').val()); ns.sessionStorage.set('submit_dir', $('#dir').val()); - //ns.localStorage.set('remember', $('#remember').is(':checked'))); + ns.localStorage.set('remember', $('#remember').prop('checked')); return true; }); diff --git a/src/assets/js/app/auth.js b/src/assets/js/app/auth.js index f963bd2..32c1851 100644 --- a/src/assets/js/app/auth.js +++ b/src/assets/js/app/auth.js @@ -4,45 +4,65 @@ $(function () { // define storages var ns = $.initNamespaceStorage('auth'), local = ns.localStorage, - session = ns.sessionStorage; - + session = ns.sessionStorage, + storage = (local.get('remember') === true) ? local : session, + authkeys = ['key', 'secret', 'dir', 'authvalid'], + submitkeys = ['submit_key','submit_secret','submit_dir']; + + // callback for validation + var checkAuth = function() { + // check authentication + if (!storage.isSet(authkeys) && storage.get('authvalid') !== true) { + location.href = 'login.html'; + } + } + // submitted? - var submitkeys = ['submit_key','submit_secret','submit_dir']; if (session.isSet(submitkeys)) { + + // define parameters + var bucket = 'librelio-europe', + key = session.get('submit_key'), + secret = session.get('submit_secret'), + dir = session.get('submit_dir'); - // check AWS + // setup AWS AWS.config.region = 'eu-west-1'; AWS.config.update({ - accessKeyId: session.get('submit_key'), - secretAccessKey: session.get('submit_secret') + accessKeyId: key, + secretAccessKey: secret }); - var s3 = new AWS.S3({params: {Bucket: 'librelio-europe'}}); - s3.listObjects(function(error,data) { - if (error === null) { - console.log(data); - } else { - console.log(error); - } - }) - + + // check auth + directory + var s3 = new AWS.S3({ region: AWS.config.region, maxRetries: 1 }); + s3.listObjects({Bucket: bucket, Prefix: dir + "/", MaxKeys: 1}, function(error,data) { + data.Contents = data.Contents || []; + if (error === null && data.Contents.length > 0) { + storage.set('key', key); + storage.set('secret', secret); + storage.set('dir', dir); + storage.set('authvalid', true); + } else { + alert("Couldn't connect to aws s3: " + err); + } + + // check the authentication + checkAuth(); + }); + // clear submitted data - //session.remove(submitkeys); + session.remove(submitkeys); } - - // check authentication - var storage = (local.get('remember') === true) ? local : session; - if (!storage.isSet(['key','secret','dir'])) { - //location.href = 'login.html'; - - } - /* - var key = storage.get('key'), - secret = storage.get('secret'), - dir = storage.get('dir'); - - if () - */ - - //ns.localStorage.set('remember', true); + else { + // check the authentication + checkAuth(); + } + + // logout button + $('.fa-power-off').click(function() { + $.removeAllStorages(); + checkAuth(); + return false; + }); }); diff --git a/src/templates/layouts/login.hbs b/src/templates/layouts/login.hbs index ec092f0..07a331f 100644 --- a/src/templates/layouts/login.hbs +++ b/src/templates/layouts/login.hbs @@ -49,7 +49,7 @@ m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) ns.sessionStorage.set('submit_key', $('#key').val()); ns.sessionStorage.set('submit_secret', $('#secret').val()); ns.sessionStorage.set('submit_dir', $('#dir').val()); - //ns.localStorage.set('remember', $('#remember').is(':checked'))); + ns.localStorage.set('remember', $('#remember').prop('checked')); return true; }); From d8f55cb3311d4cc00ea007c8034f8b10612d15db Mon Sep 17 00:00:00 2001 From: Richard Ruiter Date: Thu, 10 Apr 2014 12:39:59 +0000 Subject: [PATCH 3/4] #1 code layout --- dist/assets/js/main.js | 89 +++++++++++++++++++-------------------- src/assets/js/app/auth.js | 85 ++++++++++++++++++------------------- 2 files changed, 86 insertions(+), 88 deletions(-) diff --git a/dist/assets/js/main.js b/dist/assets/js/main.js index 2aa7056..8c225ba 100644 --- a/dist/assets/js/main.js +++ b/dist/assets/js/main.js @@ -4,74 +4,73 @@ * Copyright 2014 * Licensed under MIT */ -$(function () { +$(function() { "use strict"; - + // define storages var ns = $.initNamespaceStorage('auth'), local = ns.localStorage, session = ns.sessionStorage, - storage = (local.get('remember') === true) ? local : session, - authkeys = ['key', 'secret', 'dir', 'authvalid'], - submitkeys = ['submit_key','submit_secret','submit_dir']; - - // callback for validation - var checkAuth = function() { - // check authentication - if (!storage.isSet(authkeys) && storage.get('authvalid') !== true) { - location.href = 'login.html'; - } - } + storage = (local.get('remember') === true) ? local : session, + authkeys = ['key', 'secret', 'dir', 'authvalid'], + submitkeys = ['submit_key', 'submit_secret', 'submit_dir']; + + // callback for validation + var checkAuth = function() { + // check authentication + if (!storage.isSet(authkeys) && storage.get('authvalid') !== true) { + location.href = 'login.html'; + } + } // submitted? if (session.isSet(submitkeys)) { - // define parameters - var bucket = 'librelio-europe', - key = session.get('submit_key'), - secret = session.get('submit_secret'), - dir = session.get('submit_dir'); - + // define parameters + var bucket = 'librelio-europe', + key = session.get('submit_key'), + secret = session.get('submit_secret'), + dir = session.get('submit_dir'); + // setup AWS AWS.config.region = 'eu-west-1'; AWS.config.update({ - accessKeyId: key, + accessKeyId: key, secretAccessKey: secret }); - // check auth + directory - var s3 = new AWS.S3({ region: AWS.config.region, maxRetries: 1 }); - s3.listObjects({Bucket: bucket, Prefix: dir + "/", MaxKeys: 1}, function(error,data) { - data.Contents = data.Contents || []; - if (error === null && data.Contents.length > 0) { + // check auth + directory + var s3 = new AWS.S3({region: AWS.config.region, maxRetries: 1}); + s3.listObjects({Bucket: bucket, Prefix: dir + "/", MaxKeys: 1}, function(error, data) { + data.Contents = data.Contents || []; + if (error === null && data.Contents.length > 0) { storage.set('key', key); storage.set('secret', secret); storage.set('dir', dir); - storage.set('authvalid', true); - } else { - alert("Couldn't connect to aws s3: " + err); - } - - // check the authentication - checkAuth(); - }); + storage.set('authvalid', true); + } else { + alert("Couldn't connect to aws s3: " + err); + } + + // check the authentication + checkAuth(); + }); // clear submitted data session.remove(submitkeys); } - else { - // check the authentication - checkAuth(); - } - - // logout button - $('.fa-power-off').click(function() { - $.removeAllStorages(); - checkAuth(); - return false; - }); -}); + else { + // check the authentication + checkAuth(); + } + // logout button + $('.fa-power-off').click(function() { + $.removeAllStorages(); + checkAuth(); + return false; + }); +}); $(function () { "use strict"; diff --git a/src/assets/js/app/auth.js b/src/assets/js/app/auth.js index 32c1851..fbcf2d3 100644 --- a/src/assets/js/app/auth.js +++ b/src/assets/js/app/auth.js @@ -1,68 +1,67 @@ -$(function () { +$(function() { "use strict"; - + // define storages var ns = $.initNamespaceStorage('auth'), local = ns.localStorage, session = ns.sessionStorage, - storage = (local.get('remember') === true) ? local : session, - authkeys = ['key', 'secret', 'dir', 'authvalid'], - submitkeys = ['submit_key','submit_secret','submit_dir']; + storage = (local.get('remember') === true) ? local : session, + authkeys = ['key', 'secret', 'dir', 'authvalid'], + submitkeys = ['submit_key', 'submit_secret', 'submit_dir']; - // callback for validation - var checkAuth = function() { - // check authentication - if (!storage.isSet(authkeys) && storage.get('authvalid') !== true) { - location.href = 'login.html'; - } - } + // callback for validation + var checkAuth = function() { + // check authentication + if (!storage.isSet(authkeys) && storage.get('authvalid') !== true) { + location.href = 'login.html'; + } + } // submitted? if (session.isSet(submitkeys)) { - // define parameters - var bucket = 'librelio-europe', - key = session.get('submit_key'), - secret = session.get('submit_secret'), - dir = session.get('submit_dir'); - + // define parameters + var bucket = 'librelio-europe', + key = session.get('submit_key'), + secret = session.get('submit_secret'), + dir = session.get('submit_dir'); + // setup AWS AWS.config.region = 'eu-west-1'; AWS.config.update({ - accessKeyId: key, + accessKeyId: key, secretAccessKey: secret }); - // check auth + directory - var s3 = new AWS.S3({ region: AWS.config.region, maxRetries: 1 }); - s3.listObjects({Bucket: bucket, Prefix: dir + "/", MaxKeys: 1}, function(error,data) { - data.Contents = data.Contents || []; - if (error === null && data.Contents.length > 0) { + // check auth + directory + var s3 = new AWS.S3({region: AWS.config.region, maxRetries: 1}); + s3.listObjects({Bucket: bucket, Prefix: dir + "/", MaxKeys: 1}, function(error, data) { + data.Contents = data.Contents || []; + if (error === null && data.Contents.length > 0) { storage.set('key', key); storage.set('secret', secret); storage.set('dir', dir); - storage.set('authvalid', true); - } else { - alert("Couldn't connect to aws s3: " + err); - } - - // check the authentication - checkAuth(); - }); + storage.set('authvalid', true); + } else { + alert("Couldn't connect to aws s3: " + err); + } + + // check the authentication + checkAuth(); + }); // clear submitted data session.remove(submitkeys); } - else { - // check the authentication - checkAuth(); - } + else { + // check the authentication + checkAuth(); + } - // logout button - $('.fa-power-off').click(function() { - $.removeAllStorages(); - checkAuth(); - return false; - }); + // logout button + $('.fa-power-off').click(function() { + $.removeAllStorages(); + checkAuth(); + return false; + }); }); - From 3409e65d78c5cdcd1ec839ebc5db073eabf35387 Mon Sep 17 00:00:00 2001 From: Richard Ruiter Date: Sun, 13 Apr 2014 13:05:05 +0000 Subject: [PATCH 4/4] Fixed small problems for #1 --- dist/assets/js/main.js | 12 ++++++++++-- dist/assets/js/main.min.js | 2 +- dist/login.html | 8 ++++++++ src/assets/js/app/auth.js | 12 ++++++++++-- src/templates/layouts/login.hbs | 8 ++++++++ src/templates/login/login.hbs | 2 ++ 6 files changed, 39 insertions(+), 5 deletions(-) diff --git a/dist/assets/js/main.js b/dist/assets/js/main.js index 8c225ba..d7b6bf2 100644 --- a/dist/assets/js/main.js +++ b/dist/assets/js/main.js @@ -6,6 +6,8 @@ */ $(function() { "use strict"; + + $('body').hide(); // define storages var ns = $.initNamespaceStorage('auth'), @@ -18,9 +20,12 @@ $(function() { // callback for validation var checkAuth = function() { // check authentication - if (!storage.isSet(authkeys) && storage.get('authvalid') !== true) { + if (storage.isSet(authkeys) !== true || storage.get('authvalid') !== true) { location.href = 'login.html'; } + else { + $('body').show(); + } } // submitted? @@ -42,6 +47,7 @@ $(function() { // check auth + directory var s3 = new AWS.S3({region: AWS.config.region, maxRetries: 1}); s3.listObjects({Bucket: bucket, Prefix: dir + "/", MaxKeys: 1}, function(error, data) { + data = data || {}; data.Contents = data.Contents || []; if (error === null && data.Contents.length > 0) { storage.set('key', key); @@ -49,7 +55,7 @@ $(function() { storage.set('dir', dir); storage.set('authvalid', true); } else { - alert("Couldn't connect to aws s3: " + err); + session.set('error', "Couldn't connect to aws s3. " + error); } // check the authentication @@ -60,10 +66,12 @@ $(function() { session.remove(submitkeys); } else { + // check the authentication checkAuth(); } + // logout button $('.fa-power-off').click(function() { $.removeAllStorages(); diff --git a/dist/assets/js/main.min.js b/dist/assets/js/main.min.js index 1eed67f..bac6a67 100644 --- a/dist/assets/js/main.min.js +++ b/dist/assets/js/main.min.js @@ -4,4 +4,4 @@ * Copyright 2014 * Licensed under MIT */ -function metisButton(){window.prettyPrint&&prettyPrint(),$.each($(".inner a.btn"),function(){$(this).popover({placement:"bottom",title:this.innerHTML,content:this.outerHTML,trigger:"hover"})})}function metisChart(){"use strict";function a(a){return Math.sqrt(2)*Math.cos(a)/(Math.pow(Math.sin(a),2)+1)}function b(a){return Math.sqrt(2)*Math.cos(a)*Math.sin(a)/(Math.pow(Math.sin(a),2)+1)}var c=[[0,3],[1,8],[2,5],[3,13],[4,1]],d=[[0,12],[2,2],[3,9],[4,4]];$.plot($("#trigo"),[{data:c,label:"MAN"},{data:d,label:"WOMAN"}],{clickable:!0,hoverable:!0,series:{lines:{show:!0,fill:!0,fillColor:{colors:[{opacity:.5},{opacity:.15}]}},points:{show:!0}}}),$.plot($("#trigo2"),[{data:c,label:"BAR"}],{clickable:!0,hoverable:!0,series:{bars:{show:!0,barWidth:.6},points:{show:!0}}});for(var e=[],f=[],g=-5;5>=g;g+=.5)e.push([g,Math.pow(g,2)-25]),f.push([g,-Math.pow(g,2)+25]);for(var h=[],i=-2;2.1>=i;i+=.1)h.push([i,Math.sqrt(400-i*i*100)]),h.push([i,-Math.sqrt(400-i*i*100)]);$.plot($("#eye"),[{data:f,lines:{show:!0,fill:!0}},{data:e,lines:{show:!0,fill:!0}},{data:h,lines:{show:!0}}]);var j=[];for(g=-2;5>=g;g+=.01)j.push([16*Math.pow(Math.sin(g),3),13*Math.cos(g)-5*Math.cos(2*g)-2*Math.cos(3*g)-Math.cos(4*g)]);$.plot($("#heart"),[{data:j,label:'',color:"#9A004D"}],{series:{lines:{show:!0,fill:!0},points:{show:!1}},yaxis:{show:!0},xaxis:{show:!0}}),$("#heart .legendLabel").addClass("animated pulse"),setInterval(function(){$("#heart .legendLabel .fa.fa-heart").toggleClass("fa-2x")},400);for(var k=[],l=0;l<=2*Math.PI;l+=.01)k.push([a(l),b(l)]);$.plot($("#bernoilli"),[{data:k,label:"Lemniscate of Bernoulli",lines:{show:!0,fill:!0}}])}function dashboard(){"use strict";function a(a,b,c){$('
'+c+"
").css({position:"absolute",display:"none",top:b+5,left:a+5,border:"1px solid #fdd",padding:"2px","background-color":"#000",color:"#fff"}).appendTo("body").fadeIn(200)}$(".inlinesparkline").sparkline();var b=[10,8,5,7,4,4,1];$(".dynamicsparkline").sparkline(b),$(".dynamicbar").sparkline(b,{type:"bar",barColor:"green"}),$(".inlinebar").sparkline("html",{type:"bar",barColor:"red"}),$(".sparkline.bar_week").sparkline([5,6,7,2,0,-4,-2,4],{type:"bar",height:"40",barWidth:5,barColor:"#4d6189",negBarColor:"#a20051"}),$(".sparkline.line_day").sparkline([5,6,7,9,9,5,4,6,6,4,6,7],{type:"line",height:"40",drawNormalOnTop:!1}),$(".sparkline.pie_week").sparkline([1,1,2],{type:"pie",width:"40",height:"40"}),$(".sparkline.stacked_month").sparkline(["0:2","2:4","4:2","4:1"],{type:"bar",height:"40",barWidth:10,barColor:"#4d6189",negBarColor:"#a20051"});for(var c=new Date,d=c.getDate(),e=c.getMonth(),f=c.getFullYear(),g=$("#calendar").fullCalendar({header:{left:"prev,today,next,",center:"title",right:"month,agendaWeek,agendaDay"},selectable:!0,selectHelper:!0,select:function(a,b,c){var d=prompt("Event Title:");d&&g.fullCalendar("renderEvent",{title:d,start:a,end:b,allDay:c},!0),g.fullCalendar("unselect")},editable:!0,events:[{title:"All Day Event",start:new Date(f,e,1),className:"label label-success"},{title:"Long Event",start:new Date(f,e,d-5),end:new Date(f,e,d-2),className:"label label-info"},{id:999,title:"Repeating Event",start:new Date(f,e,d-3,16,0),allDay:!1,className:"label label-warning"},{id:999,title:"Repeating Event",start:new Date(f,e,d+4,16,0),allDay:!1,className:"label label-inverse"},{title:"Meeting",start:new Date(f,e,d,10,30),allDay:!1,className:"label label-important"},{title:"Lunch",start:new Date(f,e,d,12,0),end:new Date(f,e,d,14,0),allDay:!1},{title:"Birthday Party",start:new Date(f,e,d+1,19,0),end:new Date(f,e,d+1,22,30),allDay:!1},{title:"Click for Google",start:new Date(f,e,28),end:new Date(f,e,29),url:"http://google.com/"}]}),h=[],i=[],j=0;14>j;j+=.5)h.push([j,Math.sin(j)]),i.push([j,Math.cos(j)]);var k=($.plot($("#trigo"),[{data:h,label:"sin(x)",points:{fillColor:"#4572A7",size:5},color:"#4572A7"},{data:i,label:"cos(x)",points:{fillColor:"#333",size:35},color:"#AA4643"}],{series:{lines:{show:!0},points:{show:!0}},grid:{hoverable:!0,clickable:!0},yaxis:{min:-1.2,max:1.2}}),null);$("#trigo").bind("plothover",function(b,c,d){if($("#x").text(c.x.toFixed(2)),$("#y").text(c.y.toFixed(2)),d){if(k!==d.dataIndex){k=d.dataIndex,$("#tooltip").remove();var e=d.datapoint[0].toFixed(2),f=d.datapoint[1].toFixed(2);a(d.pageX,d.pageY,d.series.label+" of "+e+" = "+f)}}else $("#tooltip").remove(),k=null}),$(".sortableTable").tablesorter()}function formGeneral(){"use strict";$(".with-tooltip").tooltip({selector:".input-tooltip"}),$("#autosize").autosize(),$("#limiter").inputlimiter({limit:140,remText:"You only have %n character%s remaining...",limitText:"You're allowed to input %n character%s into this field."}),$("#tags").tagsInput(),$(".chzn-select").chosen(),$(".chzn-select-deselect").chosen({allow_single_deselect:!0}),$(".uniform").uniform(),$("#validVal").validVal(),$("#cp1").colorpicker({format:"hex"}),$("#cp2").colorpicker(),$("#cp3").colorpicker(),$("#cp4").colorpicker().on("changeColor",function(a){$("#colorPickerBlock").css("background-color",a.color.toHex())}),$("#dp1").datepicker({format:"mm-dd-yyyy"}),$("#dp2").datepicker(),$("#dp3").datepicker(),$("#dp3").datepicker(),$("#dpYears").datepicker(),$("#dpMonths").datepicker();var a=new Date(2014,1,20),b=new Date(2014,1,25);$("#dp4").datepicker().on("changeDate",function(c){c.date.valueOf()>b.valueOf()?$("#alert").show().find("strong").text("The start date can not be greater then the end date"):($("#alert").hide(),a=new Date(c.date),$("#startDate").text($("#dp4").data("date"))),$("#dp4").datepicker("hide")}),$("#dp5").datepicker().on("changeDate",function(c){c.date.valueOf()'+a+"");jQuery("#external-events").append(d),c(d)};$("#external-events li.external-event").each(function(){c($(this))}),$("#add-event").click(function(){var a=$("#title").val(),b=$("input:radio[name=priority]:checked").val();d(a,b)}),$("#calendar").fullCalendar({header:b,buttonText:{prev:'',next:''},editable:!0,droppable:!0,drop:function(a,b){var c=$(this).data("eventObject"),d=$.extend({},c);d.start=a,d.allDay=b,$("#calendar").fullCalendar("renderEvent",d,!0),$("#drop-remove").is(":checked")&&$(this).remove()},windowResize:function(){$("#calendar").fullCalendar("render")}})}function metisFile(){"use strict";$("#elfinder").elfinder({url:"assets/elfinder-2.0-rc1/php/connector.php"}).elfinder("instance")}function metisMaps(){"use strict";var a,b,c,d,e,f,g;a=new GMaps({el:"#gmaps-basic",lat:-12.043333,lng:-77.028333,zoomControl:!0,zoomControlOpt:{style:"SMALL",position:"TOP_LEFT"},panControl:!1,streetViewControl:!1,mapTypeControl:!1,overviewMapControl:!1}),b=new GMaps({el:"#gmaps-marker",lat:-12.043333,lng:-77.028333}),b.addMarker({lat:-12.043333,lng:-77.03,title:"Lima",details:{database_id:42,author:"HPNeo"},click:function(a){console.log&&console.log(a),alert("You clicked in this marker")},mouseover:function(a){console.log&&console.log(a)}}),b.addMarker({lat:-12.042,lng:-77.028333,title:"Marker with InfoWindow",infoWindow:{content:"

HTML Content

"}}),c=new GMaps({el:"#gmaps-geolocation",lat:-12.043333,lng:-77.028333}),GMaps.geolocate({success:function(a){c.setCenter(a.coords.latitude,a.coords.longitude)},error:function(a){alert("Geolocation failed: "+a.message)},not_supported:function(){alert("Your browser does not support geolocation")},always:function(){}}),d=new GMaps({el:"#gmaps-polylines",lat:-12.043333,lng:-77.028333,click:function(a){console.log(a)}}),f=[[-12.044012922866312,-77.02470665341184],[-12.05449279282314,-77.03024273281858],[-12.055122327623378,-77.03039293652341],[-12.075917129727586,-77.02764635449216],[-12.07635776902266,-77.02792530422971],[-12.076819390363665,-77.02893381481931],[-12.088527520066453,-77.0241058385925],[-12.090814532191756,-77.02271108990476]],d.drawPolyline({path:f,strokeColor:"#131540",strokeOpacity:.6,strokeWeight:6}),e=new GMaps({el:"#gmaps-route",lat:-12.043333,lng:-77.028333}),e.drawRoute({origin:[-12.044012922866312,-77.02470665341184],destination:[-12.090814532191756,-77.02271108990476],travelMode:"driving",strokeColor:"#131540",strokeOpacity:.6,strokeWeight:6}),g=new GMaps({el:"#gmaps-geocoding",lat:-12.043333,lng:-77.028333}),$("#geocoding_form").submit(function(a){a.preventDefault(),GMaps.geocode({address:$("#address").val().trim(),callback:function(a,b){if("OK"===b){var c=a[0].geometry.location;g.setCenter(c.lat(),c.lng()),g.addMarker({lat:c.lat(),lng:c.lng()})}}})})}function metisSortable(){$(".inner .row").sortable({})}function metisTable(){"use strict";$(".sortableTable").tablesorter(),$("#dataTable").dataTable({sDom:"<'pull-right'l>t<'row'<'col-lg-6'f><'col-lg-6'p>>",sPaginationType:"bootstrap",oLanguage:{sLengthMenu:"Show _MENU_ entries"}}),$("#actionTable button.remove").on("click",function(){$(this).closest("tr").remove()}),$("#actionTable button.edit").on("click",function(){$("#editModal").modal({show:!0});var a=$(this).closest("tr").children("td").eq(1),b=$(this).closest("tr").children("td").eq(2),c=$(this).closest("tr").children("td").eq(3);$("#editModal #fName").val(a.html()),$("#editModal #lName").val(b.html()),$("#editModal #uName").val(c.html()),$("#editModal #sbmtBtn").on("click",function(){a.html($("#editModal #fName").val()),b.html($("#editModal #lName").val()),c.html($("#editModal #uName").val())})})}function metisPricing(){$("#dark-toggle label").on("click",function(){var a=$(this);$("ul.dark li.active").removeClass("primary success danger warning info default").addClass(a.find("input").val())}),$("#light-toggle label").on("click",function(){var a=$(this);$("ul#light li.active").removeClass("primary success danger warning info default").addClass(a.find("input").val())})}function progRess(){window.prettyPrint&&prettyPrint(),$.each($(".progress .progress-bar"),function(){$(this).animate({width:$(this).attr("aria-valuenow")+"%"}),$(this).popover({placement:"bottom",title:"Source",content:this.outerHTML})})}$(function(){"use strict";var a=$.initNamespaceStorage("auth"),b=a.localStorage,c=a.sessionStorage,d=b.get("remember")===!0?b:c,e=["key","secret","dir","authvalid"],f=["submit_key","submit_secret","submit_dir"],g=function(){d.isSet(e)||d.get("authvalid")===!0||(location.href="login.html")};if(c.isSet(f)){var h="librelio-europe",i=c.get("submit_key"),j=c.get("submit_secret"),k=c.get("submit_dir");AWS.config.region="eu-west-1",AWS.config.update({accessKeyId:i,secretAccessKey:j});var l=new AWS.S3({region:AWS.config.region,maxRetries:1});l.listObjects({Bucket:h,Prefix:k+"/",MaxKeys:1},function(a,b){b.Contents=b.Contents||[],null===a&&b.Contents.length>0?(d.set("key",i),d.set("secret",j),d.set("dir",k),d.set("authvalid",!0)):alert("Couldn't connect to aws s3: "+err),g()}),c.remove(f)}else g();$(".fa-power-off").click(function(){return $.removeAllStorages(),g(),!1})}),$(function(){"use strict";$("a[href=#]").on("click",function(a){a.preventDefault()}),$("a[data-toggle=tooltip]").tooltip(),$("a[data-tooltip=tooltip]").tooltip(),$(".minimize-box").on("click",function(a){a.preventDefault();var b=$(this).children("i");b.hasClass("icon-chevron-down")?b.removeClass("icon-chevron-down").addClass("icon-chevron-up"):b.hasClass("icon-chevron-up")&&b.removeClass("icon-chevron-up").addClass("icon-chevron-down")}),$(".close-box").click(function(){$(this).closest(".box").hide("slow")}),$("#changeSidebarPos").on("click",function(){$("body").toggleClass("hide-sidebar")}),$("li.accordion-group > a").on("click",function(){$(this).children("span").children("i").toggleClass("icon-angle-down")}),$("#menu-toggle").on("click",function(a){$("#left").toggleClass("opened"),a.preventDefault()}),$("#menu").metisMenu()});var toggleFullScreen={init:function(){void 0!==window.screenfull&&screenfull.enabled?$("#toggleFullScreen").on("click",function(a){screenfull.toggle(window.document[0]),$("body").toggleClass("fullScreen"),a.preventDefault()}):$("#toggleFullScreen").addClass("hidden")}};toggleFullScreen.init();var boxFullScreen={init:function(){void 0!==window.screenfull&&screenfull.enabled?$(".full-box").on("click",function(a){var b=$(this).parents(".box")[0];screenfull.toggle(b),$(this).parents(".box").toggleClass("full-screen-box"),$(this).parents(".box").children(".body").toggleClass("full-screen-box"),$(this).children("i").toggleClass("fa-compress"),a.preventDefault()}):$(".full-box").addClass("hidden")}};boxFullScreen.init();var panelBodyCollapse={init:function(){var a=$(".collapse-box"),b=a.closest(".box").children(".body");b.collapse("show"),a.on("click",function(a){var b=$(this).closest(".box").children(".body"),c=$(this).children("i");b.on("show.bs.collapse",function(){c.removeClass("fa-minus fa-plus").addClass("fa-spinner fa-spin")}),b.on("shown.bs.collapse",function(){c.removeClass("fa-spinner fa-spin").addClass("fa-minus")}),b.on("hide.bs.collapse",function(){c.removeClass("fa-minus fa-plus").addClass("fa-spinner fa-spin")}),b.on("hidden.bs.collapse",function(){c.removeClass("fa-spinner fa-spin").addClass("fa-plus")}),b.collapse("toggle"),a.preventDefault()})}};panelBodyCollapse.init();var boxHiding={init:function(){$(".close-box").click(function(){$(this).closest(".box").hide("slow")})}};boxHiding.init(),function(a,b){function c(b,c){this.element=b,this.settings=a.extend({},e,c),this._defaults=e,this._name=d,this.init()}var d="metisMenu",e={toggle:!0,hidingClass:"u-isHiddenVisually"};c.prototype={init:function(){function c(){a("body").removeClass("mini-sidebar"),g.find("li.active").has("ul").children("ul").addClass("collapse in"),g.find("li").not(".active").has("ul").children("ul").addClass("collapse"),g.find("li").has("ul").children("a").on("click",function(b){b.preventDefault(),a(this).parent("li").toggleClass("opened").children("ul").collapse("toggle"),h&&a(this).parent("li").siblings().removeClass("opened").children("ul.in").collapse("hide")})}function d(){g.find("li").has("ul").children("ul").removeClass("collapse in").css("height","inherit"),g.hasClass("affix")||g.find("li").has("ul").children("a").off("click")}function e(){a(b).width()<992?c():d()}{var f,g=a(this.element),h=this.settings.toggle;this.settings.hidingClass}e(),g.on("affix.bs.affix",function(){console.log("affix.bs.affix")}),g.on("affix-top.bs.affix",function(){console.log("affix-top.bs.affix")}),g.on("affixed.bs.affix",function(){c(),console.log("affixed.bs.affix")}),g.on("affixed-top.bs.affix",function(){d(),console.log("affixed-top.bs.affix")}),a(b).resize(function(){clearTimeout(f),f=setTimeout(e,250)})}},a.fn[d]=function(b){return this.each(function(){a.data(this,"plugin_"+d)||a.data(this,"plugin_"+d,new c(this,b))})}}(jQuery,window,document); \ No newline at end of file +function metisButton(){window.prettyPrint&&prettyPrint(),$.each($(".inner a.btn"),function(){$(this).popover({placement:"bottom",title:this.innerHTML,content:this.outerHTML,trigger:"hover"})})}function metisChart(){"use strict";function a(a){return Math.sqrt(2)*Math.cos(a)/(Math.pow(Math.sin(a),2)+1)}function b(a){return Math.sqrt(2)*Math.cos(a)*Math.sin(a)/(Math.pow(Math.sin(a),2)+1)}var c=[[0,3],[1,8],[2,5],[3,13],[4,1]],d=[[0,12],[2,2],[3,9],[4,4]];$.plot($("#trigo"),[{data:c,label:"MAN"},{data:d,label:"WOMAN"}],{clickable:!0,hoverable:!0,series:{lines:{show:!0,fill:!0,fillColor:{colors:[{opacity:.5},{opacity:.15}]}},points:{show:!0}}}),$.plot($("#trigo2"),[{data:c,label:"BAR"}],{clickable:!0,hoverable:!0,series:{bars:{show:!0,barWidth:.6},points:{show:!0}}});for(var e=[],f=[],g=-5;5>=g;g+=.5)e.push([g,Math.pow(g,2)-25]),f.push([g,-Math.pow(g,2)+25]);for(var h=[],i=-2;2.1>=i;i+=.1)h.push([i,Math.sqrt(400-i*i*100)]),h.push([i,-Math.sqrt(400-i*i*100)]);$.plot($("#eye"),[{data:f,lines:{show:!0,fill:!0}},{data:e,lines:{show:!0,fill:!0}},{data:h,lines:{show:!0}}]);var j=[];for(g=-2;5>=g;g+=.01)j.push([16*Math.pow(Math.sin(g),3),13*Math.cos(g)-5*Math.cos(2*g)-2*Math.cos(3*g)-Math.cos(4*g)]);$.plot($("#heart"),[{data:j,label:'',color:"#9A004D"}],{series:{lines:{show:!0,fill:!0},points:{show:!1}},yaxis:{show:!0},xaxis:{show:!0}}),$("#heart .legendLabel").addClass("animated pulse"),setInterval(function(){$("#heart .legendLabel .fa.fa-heart").toggleClass("fa-2x")},400);for(var k=[],l=0;l<=2*Math.PI;l+=.01)k.push([a(l),b(l)]);$.plot($("#bernoilli"),[{data:k,label:"Lemniscate of Bernoulli",lines:{show:!0,fill:!0}}])}function dashboard(){"use strict";function a(a,b,c){$('
'+c+"
").css({position:"absolute",display:"none",top:b+5,left:a+5,border:"1px solid #fdd",padding:"2px","background-color":"#000",color:"#fff"}).appendTo("body").fadeIn(200)}$(".inlinesparkline").sparkline();var b=[10,8,5,7,4,4,1];$(".dynamicsparkline").sparkline(b),$(".dynamicbar").sparkline(b,{type:"bar",barColor:"green"}),$(".inlinebar").sparkline("html",{type:"bar",barColor:"red"}),$(".sparkline.bar_week").sparkline([5,6,7,2,0,-4,-2,4],{type:"bar",height:"40",barWidth:5,barColor:"#4d6189",negBarColor:"#a20051"}),$(".sparkline.line_day").sparkline([5,6,7,9,9,5,4,6,6,4,6,7],{type:"line",height:"40",drawNormalOnTop:!1}),$(".sparkline.pie_week").sparkline([1,1,2],{type:"pie",width:"40",height:"40"}),$(".sparkline.stacked_month").sparkline(["0:2","2:4","4:2","4:1"],{type:"bar",height:"40",barWidth:10,barColor:"#4d6189",negBarColor:"#a20051"});for(var c=new Date,d=c.getDate(),e=c.getMonth(),f=c.getFullYear(),g=$("#calendar").fullCalendar({header:{left:"prev,today,next,",center:"title",right:"month,agendaWeek,agendaDay"},selectable:!0,selectHelper:!0,select:function(a,b,c){var d=prompt("Event Title:");d&&g.fullCalendar("renderEvent",{title:d,start:a,end:b,allDay:c},!0),g.fullCalendar("unselect")},editable:!0,events:[{title:"All Day Event",start:new Date(f,e,1),className:"label label-success"},{title:"Long Event",start:new Date(f,e,d-5),end:new Date(f,e,d-2),className:"label label-info"},{id:999,title:"Repeating Event",start:new Date(f,e,d-3,16,0),allDay:!1,className:"label label-warning"},{id:999,title:"Repeating Event",start:new Date(f,e,d+4,16,0),allDay:!1,className:"label label-inverse"},{title:"Meeting",start:new Date(f,e,d,10,30),allDay:!1,className:"label label-important"},{title:"Lunch",start:new Date(f,e,d,12,0),end:new Date(f,e,d,14,0),allDay:!1},{title:"Birthday Party",start:new Date(f,e,d+1,19,0),end:new Date(f,e,d+1,22,30),allDay:!1},{title:"Click for Google",start:new Date(f,e,28),end:new Date(f,e,29),url:"http://google.com/"}]}),h=[],i=[],j=0;14>j;j+=.5)h.push([j,Math.sin(j)]),i.push([j,Math.cos(j)]);var k=($.plot($("#trigo"),[{data:h,label:"sin(x)",points:{fillColor:"#4572A7",size:5},color:"#4572A7"},{data:i,label:"cos(x)",points:{fillColor:"#333",size:35},color:"#AA4643"}],{series:{lines:{show:!0},points:{show:!0}},grid:{hoverable:!0,clickable:!0},yaxis:{min:-1.2,max:1.2}}),null);$("#trigo").bind("plothover",function(b,c,d){if($("#x").text(c.x.toFixed(2)),$("#y").text(c.y.toFixed(2)),d){if(k!==d.dataIndex){k=d.dataIndex,$("#tooltip").remove();var e=d.datapoint[0].toFixed(2),f=d.datapoint[1].toFixed(2);a(d.pageX,d.pageY,d.series.label+" of "+e+" = "+f)}}else $("#tooltip").remove(),k=null}),$(".sortableTable").tablesorter()}function formGeneral(){"use strict";$(".with-tooltip").tooltip({selector:".input-tooltip"}),$("#autosize").autosize(),$("#limiter").inputlimiter({limit:140,remText:"You only have %n character%s remaining...",limitText:"You're allowed to input %n character%s into this field."}),$("#tags").tagsInput(),$(".chzn-select").chosen(),$(".chzn-select-deselect").chosen({allow_single_deselect:!0}),$(".uniform").uniform(),$("#validVal").validVal(),$("#cp1").colorpicker({format:"hex"}),$("#cp2").colorpicker(),$("#cp3").colorpicker(),$("#cp4").colorpicker().on("changeColor",function(a){$("#colorPickerBlock").css("background-color",a.color.toHex())}),$("#dp1").datepicker({format:"mm-dd-yyyy"}),$("#dp2").datepicker(),$("#dp3").datepicker(),$("#dp3").datepicker(),$("#dpYears").datepicker(),$("#dpMonths").datepicker();var a=new Date(2014,1,20),b=new Date(2014,1,25);$("#dp4").datepicker().on("changeDate",function(c){c.date.valueOf()>b.valueOf()?$("#alert").show().find("strong").text("The start date can not be greater then the end date"):($("#alert").hide(),a=new Date(c.date),$("#startDate").text($("#dp4").data("date"))),$("#dp4").datepicker("hide")}),$("#dp5").datepicker().on("changeDate",function(c){c.date.valueOf()'+a+"");jQuery("#external-events").append(d),c(d)};$("#external-events li.external-event").each(function(){c($(this))}),$("#add-event").click(function(){var a=$("#title").val(),b=$("input:radio[name=priority]:checked").val();d(a,b)}),$("#calendar").fullCalendar({header:b,buttonText:{prev:'',next:''},editable:!0,droppable:!0,drop:function(a,b){var c=$(this).data("eventObject"),d=$.extend({},c);d.start=a,d.allDay=b,$("#calendar").fullCalendar("renderEvent",d,!0),$("#drop-remove").is(":checked")&&$(this).remove()},windowResize:function(){$("#calendar").fullCalendar("render")}})}function metisFile(){"use strict";$("#elfinder").elfinder({url:"assets/elfinder-2.0-rc1/php/connector.php"}).elfinder("instance")}function metisMaps(){"use strict";var a,b,c,d,e,f,g;a=new GMaps({el:"#gmaps-basic",lat:-12.043333,lng:-77.028333,zoomControl:!0,zoomControlOpt:{style:"SMALL",position:"TOP_LEFT"},panControl:!1,streetViewControl:!1,mapTypeControl:!1,overviewMapControl:!1}),b=new GMaps({el:"#gmaps-marker",lat:-12.043333,lng:-77.028333}),b.addMarker({lat:-12.043333,lng:-77.03,title:"Lima",details:{database_id:42,author:"HPNeo"},click:function(a){console.log&&console.log(a),alert("You clicked in this marker")},mouseover:function(a){console.log&&console.log(a)}}),b.addMarker({lat:-12.042,lng:-77.028333,title:"Marker with InfoWindow",infoWindow:{content:"

HTML Content

"}}),c=new GMaps({el:"#gmaps-geolocation",lat:-12.043333,lng:-77.028333}),GMaps.geolocate({success:function(a){c.setCenter(a.coords.latitude,a.coords.longitude)},error:function(a){alert("Geolocation failed: "+a.message)},not_supported:function(){alert("Your browser does not support geolocation")},always:function(){}}),d=new GMaps({el:"#gmaps-polylines",lat:-12.043333,lng:-77.028333,click:function(a){console.log(a)}}),f=[[-12.044012922866312,-77.02470665341184],[-12.05449279282314,-77.03024273281858],[-12.055122327623378,-77.03039293652341],[-12.075917129727586,-77.02764635449216],[-12.07635776902266,-77.02792530422971],[-12.076819390363665,-77.02893381481931],[-12.088527520066453,-77.0241058385925],[-12.090814532191756,-77.02271108990476]],d.drawPolyline({path:f,strokeColor:"#131540",strokeOpacity:.6,strokeWeight:6}),e=new GMaps({el:"#gmaps-route",lat:-12.043333,lng:-77.028333}),e.drawRoute({origin:[-12.044012922866312,-77.02470665341184],destination:[-12.090814532191756,-77.02271108990476],travelMode:"driving",strokeColor:"#131540",strokeOpacity:.6,strokeWeight:6}),g=new GMaps({el:"#gmaps-geocoding",lat:-12.043333,lng:-77.028333}),$("#geocoding_form").submit(function(a){a.preventDefault(),GMaps.geocode({address:$("#address").val().trim(),callback:function(a,b){if("OK"===b){var c=a[0].geometry.location;g.setCenter(c.lat(),c.lng()),g.addMarker({lat:c.lat(),lng:c.lng()})}}})})}function metisSortable(){$(".inner .row").sortable({})}function metisTable(){"use strict";$(".sortableTable").tablesorter(),$("#dataTable").dataTable({sDom:"<'pull-right'l>t<'row'<'col-lg-6'f><'col-lg-6'p>>",sPaginationType:"bootstrap",oLanguage:{sLengthMenu:"Show _MENU_ entries"}}),$("#actionTable button.remove").on("click",function(){$(this).closest("tr").remove()}),$("#actionTable button.edit").on("click",function(){$("#editModal").modal({show:!0});var a=$(this).closest("tr").children("td").eq(1),b=$(this).closest("tr").children("td").eq(2),c=$(this).closest("tr").children("td").eq(3);$("#editModal #fName").val(a.html()),$("#editModal #lName").val(b.html()),$("#editModal #uName").val(c.html()),$("#editModal #sbmtBtn").on("click",function(){a.html($("#editModal #fName").val()),b.html($("#editModal #lName").val()),c.html($("#editModal #uName").val())})})}function metisPricing(){$("#dark-toggle label").on("click",function(){var a=$(this);$("ul.dark li.active").removeClass("primary success danger warning info default").addClass(a.find("input").val())}),$("#light-toggle label").on("click",function(){var a=$(this);$("ul#light li.active").removeClass("primary success danger warning info default").addClass(a.find("input").val())})}function progRess(){window.prettyPrint&&prettyPrint(),$.each($(".progress .progress-bar"),function(){$(this).animate({width:$(this).attr("aria-valuenow")+"%"}),$(this).popover({placement:"bottom",title:"Source",content:this.outerHTML})})}$(function(){"use strict";$("body").hide();var a=$.initNamespaceStorage("auth"),b=a.localStorage,c=a.sessionStorage,d=b.get("remember")===!0?b:c,e=["key","secret","dir","authvalid"],f=["submit_key","submit_secret","submit_dir"],g=function(){d.isSet(e)!==!0||d.get("authvalid")!==!0?location.href="login.html":$("body").show()};if(c.isSet(f)){var h="librelio-europe",i=c.get("submit_key"),j=c.get("submit_secret"),k=c.get("submit_dir");AWS.config.region="eu-west-1",AWS.config.update({accessKeyId:i,secretAccessKey:j});var l=new AWS.S3({region:AWS.config.region,maxRetries:1});l.listObjects({Bucket:h,Prefix:k+"/",MaxKeys:1},function(a,b){b=b||{},b.Contents=b.Contents||[],null===a&&b.Contents.length>0?(d.set("key",i),d.set("secret",j),d.set("dir",k),d.set("authvalid",!0)):c.set("error","Couldn't connect to aws s3. "+a),g()}),c.remove(f)}else g();$(".fa-power-off").click(function(){return $.removeAllStorages(),g(),!1})}),$(function(){"use strict";$("a[href=#]").on("click",function(a){a.preventDefault()}),$("a[data-toggle=tooltip]").tooltip(),$("a[data-tooltip=tooltip]").tooltip(),$(".minimize-box").on("click",function(a){a.preventDefault();var b=$(this).children("i");b.hasClass("icon-chevron-down")?b.removeClass("icon-chevron-down").addClass("icon-chevron-up"):b.hasClass("icon-chevron-up")&&b.removeClass("icon-chevron-up").addClass("icon-chevron-down")}),$(".close-box").click(function(){$(this).closest(".box").hide("slow")}),$("#changeSidebarPos").on("click",function(){$("body").toggleClass("hide-sidebar")}),$("li.accordion-group > a").on("click",function(){$(this).children("span").children("i").toggleClass("icon-angle-down")}),$("#menu-toggle").on("click",function(a){$("#left").toggleClass("opened"),a.preventDefault()}),$("#menu").metisMenu()});var toggleFullScreen={init:function(){void 0!==window.screenfull&&screenfull.enabled?$("#toggleFullScreen").on("click",function(a){screenfull.toggle(window.document[0]),$("body").toggleClass("fullScreen"),a.preventDefault()}):$("#toggleFullScreen").addClass("hidden")}};toggleFullScreen.init();var boxFullScreen={init:function(){void 0!==window.screenfull&&screenfull.enabled?$(".full-box").on("click",function(a){var b=$(this).parents(".box")[0];screenfull.toggle(b),$(this).parents(".box").toggleClass("full-screen-box"),$(this).parents(".box").children(".body").toggleClass("full-screen-box"),$(this).children("i").toggleClass("fa-compress"),a.preventDefault()}):$(".full-box").addClass("hidden")}};boxFullScreen.init();var panelBodyCollapse={init:function(){var a=$(".collapse-box"),b=a.closest(".box").children(".body");b.collapse("show"),a.on("click",function(a){var b=$(this).closest(".box").children(".body"),c=$(this).children("i");b.on("show.bs.collapse",function(){c.removeClass("fa-minus fa-plus").addClass("fa-spinner fa-spin")}),b.on("shown.bs.collapse",function(){c.removeClass("fa-spinner fa-spin").addClass("fa-minus")}),b.on("hide.bs.collapse",function(){c.removeClass("fa-minus fa-plus").addClass("fa-spinner fa-spin")}),b.on("hidden.bs.collapse",function(){c.removeClass("fa-spinner fa-spin").addClass("fa-plus")}),b.collapse("toggle"),a.preventDefault()})}};panelBodyCollapse.init();var boxHiding={init:function(){$(".close-box").click(function(){$(this).closest(".box").hide("slow")})}};boxHiding.init(),function(a,b){function c(b,c){this.element=b,this.settings=a.extend({},e,c),this._defaults=e,this._name=d,this.init()}var d="metisMenu",e={toggle:!0,hidingClass:"u-isHiddenVisually"};c.prototype={init:function(){function c(){a("body").removeClass("mini-sidebar"),g.find("li.active").has("ul").children("ul").addClass("collapse in"),g.find("li").not(".active").has("ul").children("ul").addClass("collapse"),g.find("li").has("ul").children("a").on("click",function(b){b.preventDefault(),a(this).parent("li").toggleClass("opened").children("ul").collapse("toggle"),h&&a(this).parent("li").siblings().removeClass("opened").children("ul.in").collapse("hide")})}function d(){g.find("li").has("ul").children("ul").removeClass("collapse in").css("height","inherit"),g.hasClass("affix")||g.find("li").has("ul").children("a").off("click")}function e(){a(b).width()<992?c():d()}{var f,g=a(this.element),h=this.settings.toggle;this.settings.hidingClass}e(),g.on("affix.bs.affix",function(){console.log("affix.bs.affix")}),g.on("affix-top.bs.affix",function(){console.log("affix-top.bs.affix")}),g.on("affixed.bs.affix",function(){c(),console.log("affixed.bs.affix")}),g.on("affixed-top.bs.affix",function(){d(),console.log("affixed-top.bs.affix")}),a(b).resize(function(){clearTimeout(f),f=setTimeout(e,250)})}},a.fn[d]=function(b){return this.each(function(){a.data(this,"plugin_"+d)||a.data(this,"plugin_"+d,new c(this,b))})}}(jQuery,window,document); \ No newline at end of file diff --git a/dist/login.html b/dist/login.html index ff0c055..026f429 100644 --- a/dist/login.html +++ b/dist/login.html @@ -32,6 +32,7 @@