123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790 |
- var App = function () {
- var currentPage = ''; // current page
- var collapsed = false; //sidebar collapsed
- var is_mobile = false; //is screen mobile?
- var is_mini_menu = false; //is mini-menu activated
- var is_fixed_header = false; //is fixed header activated
- var responsiveFunctions = []; //responsive function holder
- var adminUrl = '/admin/';
- /*-----------------------------------------------------------------------------------*/
- /* admin login
- /*-----------------------------------------------------------------------------------*/
- var handleLogin = function () {
- $("#adminLoginSub").click(function(){
- $.ajax({
- cache: true,
- type: "POST",
- url: adminUrl + "adminLogin/",
- data:$('#adminLoginForm').serialize(),
- async: false,
- error: function(request) {
- alert("Connection error");
- },
- success: function(data) {
- if(data)
- location.href = adminUrl;
- else
- bootbox.alert("用户名密码错误,请重新输入");
- }
- });
- });
- }
- /*-----------------------------------------------------------------------------------*/
- /* admin uesrEdit
- /*-----------------------------------------------------------------------------------*/
- var handleUploadAvatar = function () {
- // var upload_path = "http://127.0.0.1/usky/uploads/avatar";
- var upload_path = "http://www.usky.cn/uploads/avatar";
- $("#fileupload").click(function(){
- $(this).fileupload({
- url : adminUrl + 'upload/uploadAvatar',
- dataType: 'json',
- done: function (e, data) {
- $.each(data.result.files, function (index, file) {
- $('#img').val(upload_path+'/'+file.name);
- });
- }
- });
- });
- }
- /*-----------------------------------------------------------------------------------*/
- /* admin uesrEdit
- /*-----------------------------------------------------------------------------------*/
- var handleUploadLogo = function () {
- // var upload_path = "http://127.0.0.1/usky/uploads/logo";
- var upload_path = "http://www.usky.cn/uploads/logo";
- $("#fileupload").each(function(){
- $(this).click(function(){
- $(this).fileupload({
- url : adminUrl + 'upload/uploadLogo',
- dataType: 'json',
- done: function (e, data) {
- $.each(data.result.files, function (index, file) {
- $('#img').val(upload_path+'/'+file.name);
- });
- }
- });
- });
- });
- }
- /*-----------------------------------------------------------------------------------*/
- /* admin uesrEdit
- /*-----------------------------------------------------------------------------------*/
- var handleUploadSlider = function () {
- // var upload_path = "http://127.0.0.1/usky/uploads/avatar";
- var upload_path = "http://www.usky.cn/uploads/avatar";
- $(".fileupload").each(function(){
- $(this).click(function(){
- var oImg = $(this).parent().parent().find(".cover");
- $(this).fileupload({
- url : adminUrl + 'upload/uploadAvatar',
- dataType: 'json',
- done: function (e, data) {
- $.each(data.result.files, function (index, file) {
- oImg.val(upload_path+'/'+file.name);
- });
- }
- });
- });
- });
- }
- /*-----------------------------------------------------------------------------------*/
- /* admin uesrEdit
- /*-----------------------------------------------------------------------------------*/
- var handleUploadPdf = function () {
- $("#fileupload").each(function(){
- $(this).click(function(){
- $(this).fileupload({
- url : adminUrl + 'upload/uploadFile',
- dataType: 'json',
- done: function (e, data) {
- $.each(data.result.files, function (index, file) {
- $('#img').val(file.name);
- });
- },
- progressall: function (e, data) {
- var progress = parseInt(data.loaded / data.total * 100, 10);
- $('#progress1').css(
- 'width',
- progress + '%'
- );
- if (progress==100) {
- setInterval(function() {
- $('#progress1').css(
- 'width',
- '0%'
- );
- },1000);
- }
- }
- });
- });
- });
- }
- /*-----------------------------------------------------------------------------------*/
- /* admin handleUserModifyPass
- /*-----------------------------------------------------------------------------------*/
- var handleUserModifyPass = function () {
- $("#fileupload").click(function(){
- $(this).fileupload({
- url : adminUrl + 'upload/uploadAvatar',
- dataType: 'json',
- done: function (e, data) {
- $.each(data.result.files, function (index, file) {
- $('#adImg').val(upload_path+'/'+file.name);
- });
- }
- });
- });
- }
- /*-----------------------------------------------------------------------------------*/
- /* 添加首页合作伙伴LOGO
- /*-----------------------------------------------------------------------------------*/
- // var addHomepageLogo = function () {
- // $('#addHomepageLogo').click(function(){
- // var msg = $("#addHomepageLogoHtml").html();
- // bootbox.dialog({
- // message: msg,
- // title: '添加合作伙伴',
- // size: 'large'
- // })
- // });
- // }
- /*-----------------------------------------------------------------------------------*/
- /* Runs callback functions set by App.addResponsiveFunction()
- /*-----------------------------------------------------------------------------------*/
- var runResponsiveFunctions = function () {
- // reinitialize other subscribed elements
- for (var i in responsiveFunctions) {
- var each = responsiveFunctions[i];
- each.call();
- }
- }
- /*-----------------------------------------------------------------------------------*/
- /* To get the correct viewport width based on http://andylangton.co.uk/articles/javascript/get-viewport-size-javascript/
- /*-----------------------------------------------------------------------------------*/
- var getViewPort = function () {
- var e = window, a = 'inner';
- if (!('innerWidth' in window)) {
- a = 'client';
- e = document.documentElement || document.body;
- }
- return {
- width: e[a + 'Width'],
- height: e[a + 'Height']
- }
- }
- /*-----------------------------------------------------------------------------------*/
- /* Check layout size
- /*-----------------------------------------------------------------------------------*/
- var checkLayout = function() {
- //Check if sidebar has mini-menu
- is_mini_menu = $('#sidebar').hasClass('mini-menu');
- //Check if fixed header is activated
- is_fixed_header = $('#header').hasClass('navbar-fixed-top');
- }
- /*-----------------------------------------------------------------------------------*/
- /* Sidebar & Main Content size match
- /*-----------------------------------------------------------------------------------*/
- var handleSidebarAndContentHeight = function () {
- var content = $('#content');
- var sidebar = $('#sidebar');
- var body = $('body');
- var height;
- if (body.hasClass('sidebar-fixed')) {
- height = $(window).height() - $('#header').height() + 1;
- } else {
- height = sidebar.height() + 20;
- }
- if (height >= content.height()) {
- content.attr('style', 'min-height:' + height + 'px !important');
- }
- }
- /*-----------------------------------------------------------------------------------*/
- /* Sidebar
- /*-----------------------------------------------------------------------------------*/
- var handleSidebar = function () {
- jQuery('.sidebar-menu .has-sub > a').click(function () {
- var last = jQuery('.has-sub.open', $('.sidebar-menu'));
- last.removeClass("open");
- jQuery('.arrow', last).removeClass("open");
- jQuery('.sub', last).slideUp(200);
-
- var thisElement = $(this);
- var slideOffeset = -200;
- var slideSpeed = 200;
-
- var sub = jQuery(this).next();
- if (sub.is(":visible")) {
- jQuery('.arrow', jQuery(this)).removeClass("open");
- jQuery(this).parent().removeClass("open");
- sub.slideUp(slideSpeed, function () {
- if ($('#sidebar').hasClass('sidebar-fixed') == false) {
- App.scrollTo(thisElement, slideOffeset);
- }
- handleSidebarAndContentHeight();
- });
- } else {
- jQuery('.arrow', jQuery(this)).addClass("open");
- jQuery(this).parent().addClass("open");
- sub.slideDown(slideSpeed, function () {
- if ($('#sidebar').hasClass('sidebar-fixed') == false) {
- App.scrollTo(thisElement, slideOffeset);
- }
- handleSidebarAndContentHeight();
- });
- }
- });
-
- // Handle sub-sub menus
- jQuery('.sidebar-menu .has-sub .sub .has-sub-sub > a').click(function () {
- var last = jQuery('.has-sub-sub.open', $('.sidebar-menu'));
- last.removeClass("open");
- jQuery('.arrow', last).removeClass("open");
- jQuery('.sub', last).slideUp(200);
-
- var sub = jQuery(this).next();
- if (sub.is(":visible")) {
- jQuery('.arrow', jQuery(this)).removeClass("open");
- jQuery(this).parent().removeClass("open");
- sub.slideUp(200);
- } else {
- jQuery('.arrow', jQuery(this)).addClass("open");
- jQuery(this).parent().addClass("open");
- sub.slideDown(200);
- }
- });
- }
-
- /*-----------------------------------------------------------------------------------*/
- /* Collapse Sidebar Programatically
- /*-----------------------------------------------------------------------------------*/
- var collapseSidebar = function () {
- var iconElem = document.getElementById("sidebar-collapse").querySelector('[class*="fa-"]');
- var iconLeft = iconElem.getAttribute("data-icon1");
- var iconRight = iconElem.getAttribute("data-icon2");
- /* For Navbar */
- jQuery('.navbar-brand').addClass("mini-menu");
- /* For sidebar */
- jQuery('#sidebar').addClass("mini-menu");
- jQuery('#main-content').addClass("margin-left-50");
- jQuery('.sidebar-collapse i').removeClass(iconLeft);
- jQuery('.sidebar-collapse i').addClass(iconRight);
- /* Remove placeholder from Search Bar */
- jQuery('.search').attr('placeholder', '');
- collapsed = true;
- /* Set a cookie so that mini-sidebar persists */
- $.cookie('mini_sidebar', '1');
- }
- /*-----------------------------------------------------------------------------------*/
- /* Responsive Sidebar Collapse
- /*-----------------------------------------------------------------------------------*/
- var responsiveSidebar = function () {
- //Handle sidebar collapse on screen width
- var width = $(window).width();
- if ( width < 768 ) {
- is_mobile = true;
- //Hide the sidebar completely
- jQuery('#main-content').addClass("margin-left-0");
- }
- else {
- is_mobile = false;
- //Show the sidebar completely
- jQuery('#main-content').removeClass("margin-left-0");
- var menu = $('.sidebar');
- if (menu.parent('.slimScrollDiv').size() === 1) { // destroy existing instance before resizing
- menu.slimScroll({
- destroy: true
- });
- menu.removeAttr('style');
- $('#sidebar').removeAttr('style');
- }
- }
- }
- /*-----------------------------------------------------------------------------------*/
- /* Sidebar Collapse
- /*-----------------------------------------------------------------------------------*/
- var handleSidebarCollapse = function () {
- var viewport = getViewPort();
- if ($.cookie('mini_sidebar') === '1') {
- /* For Navbar */
- jQuery('.navbar-brand').addClass("mini-menu");
- /* For sidebar */
- jQuery('#sidebar').addClass("mini-menu");
- jQuery('#main-content').addClass("margin-left-50");
- collapsed = true;
- }
- //Handle sidebar collapse on user interaction
- jQuery('.sidebar-collapse').click(function () {
- //Handle mobile sidebar toggle
- if(is_mobile && !(is_mini_menu)){
- //If sidebar is collapsed
- if(collapsed){
- jQuery('body').removeClass("slidebar");
- jQuery('.sidebar').removeClass("sidebar-fixed");
- //Add fixed top nav if exists
- if(is_fixed_header) {
- jQuery('#header').addClass("navbar-fixed-top");
- jQuery('#main-content').addClass("margin-top-100");
- }
- collapsed = false;
- $.cookie('mini_sidebar', '0');
- }
- else {
- jQuery('body').addClass("slidebar");
- jQuery('.sidebar').addClass("sidebar-fixed");
- //Remove fixed top nav if exists
- if(is_fixed_header) {
- jQuery('#header').removeClass("navbar-fixed-top");
- jQuery('#main-content').removeClass("margin-top-100");
- }
- collapsed = true;
- $.cookie('mini_sidebar', '1');
- handleMobileSidebar();
- }
- }
- else { //Handle regular sidebar toggle
- var iconElem = document.getElementById("sidebar-collapse").querySelector('[class*="fa-"]');
- var iconLeft = iconElem.getAttribute("data-icon1");
- var iconRight = iconElem.getAttribute("data-icon2");
- //If sidebar is collapsed
- if(collapsed){
- /* For Navbar */
- jQuery('.navbar-brand').removeClass("mini-menu");
- /* For sidebar */
- jQuery('#sidebar').removeClass("mini-menu");
- jQuery('#main-content').removeClass("margin-left-50");
- jQuery('.sidebar-collapse i').removeClass(iconRight);
- jQuery('.sidebar-collapse i').addClass(iconLeft);
- /* Add placeholder from Search Bar */
- jQuery('.search').attr('placeholder', "Search");
- collapsed = false;
- $.cookie('mini_sidebar', '0');
- }
- else {
- /* For Navbar */
- jQuery('.navbar-brand').addClass("mini-menu");
- /* For sidebar */
- jQuery('#sidebar').addClass("mini-menu");
- jQuery('#main-content').addClass("margin-left-50");
- jQuery('.sidebar-collapse i').removeClass(iconLeft);
- jQuery('.sidebar-collapse i').addClass(iconRight);
- /* Remove placeholder from Search Bar */
- jQuery('.search').attr('placeholder', '');
- collapsed = true;
- $.cookie('mini_sidebar', '1');
- }
- $("#main-content").on('resize', function (e) {
- e.stopPropagation();
- });
- }
- });
- }
- /*-----------------------------------------------------------------------------------*/
- /* Handle Fixed Sidebar on Mobile devices
- /*-----------------------------------------------------------------------------------*/
- var handleMobileSidebar = function () {
- var menu = $('.sidebar');
- if (menu.parent('.slimScrollDiv').size() === 1) { // destroy existing instance before updating the height
- menu.slimScroll({
- destroy: true
- });
- menu.removeAttr('style');
- $('#sidebar').removeAttr('style');
- }
- menu.slimScroll({
- size: '7px',
- color: '#a1b2bd',
- opacity: .3,
- height: "100%",
- allowPageScroll: false,
- disableFadeOut: false
- });
- }
- /*-----------------------------------------------------------------------------------*/
- /* Handle Fixed Sidebar
- /*-----------------------------------------------------------------------------------*/
- var handleFixedSidebar = function () {
- var menu = $('.sidebar-menu');
- if (menu.parent('.slimScrollDiv').size() === 1) { // destroy existing instance before updating the height
- menu.slimScroll({
- destroy: true
- });
- menu.removeAttr('style');
- $('#sidebar').removeAttr('style');
- }
- if ($('.sidebar-fixed').size() === 0) {
- handleSidebarAndContentHeight();
- return;
- }
- var viewport = getViewPort();
- if (viewport.width >= 992) {
- var sidebarHeight = $(window).height() - $('#header').height() + 1;
- menu.slimScroll({
- size: '7px',
- color: '#a1b2bd',
- opacity: .3,
- height: sidebarHeight,
- allowPageScroll: false,
- disableFadeOut: false
- });
- handleSidebarAndContentHeight();
- }
- }
- /*-----------------------------------------------------------------------------------*/
- /* Windows Resize function
- /*-----------------------------------------------------------------------------------*/
- jQuery(window).resize(function() {
- setTimeout(function () {
- checkLayout();
- handleSidebarAndContentHeight();
- responsiveSidebar();
- handleFixedSidebar();
- handleNavbarFixedTop();
- runResponsiveFunctions();
- }, 50); // wait 50ms until window resize finishes.
- });
- /*-----------------------------------------------------------------------------------*/
- /* Date Range Picker
- /*-----------------------------------------------------------------------------------*/
- // var handleDateTimePickers = function () {
- // $('#reportrange').daterangepicker(
- // {
- // startDate: moment().subtract('days', 29),
- // endDate: moment(),
- // minDate: '01/01/2012',
- // maxDate: '12/31/2014',
- // dateLimit: { days: 60 },
- // showDropdowns: true,
- // showWeekNumbers: true,
- // timePicker: false,
- // timePickerIncrement: 1,
- // timePicker12Hour: true,
- // ranges: {
- // 'Yesterday': [moment().subtract('days', 1), moment().subtract('days', 1)],
- // 'Last 30 Days': [moment().subtract('days', 29), moment()],
- // 'This Month': [moment().startOf('month'), moment().endOf('month')]
- // },
- // opens: 'left',
- // buttonClasses: ['btn btn-default'],
- // applyClass: 'btn-small btn-primary',
- // cancelClass: 'btn-small',
- // format: 'MM/DD/YYYY',
- // separator: ' to ',
- // locale: {
- // applyLabel: 'Submit',
- // fromLabel: 'From',
- // toLabel: 'To',
- // customRangeLabel: 'Custom Range',
- // daysOfWeek: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr','Sa'],
- // monthNames: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
- // firstDay: 1
- // }
- // },
- // function(start, end) {
- // console.log("Callback has been called!");
- // $('#reportrange span').html(start.format('MMMM D, YYYY') + ' - ' + end.format('MMMM D, YYYY'));
- // }
- // );
- // //Set the initial state of the picker label
- // $('#reportrange span').html('Custom');
- // }
-
- /*-----------------------------------------------------------------------------------*/
- /* Team View
- /*-----------------------------------------------------------------------------------*/
- var handleTeamView = function () {
- c();
- $(".team-status-toggle").click(function (y) {
- y.preventDefault();
- w(this);
- $(this).parent().toggleClass("open");
- var z = x(this);
- $(z).slideToggle(200, function () {
- $(this).toggleClass("open")
- })
- });
- $("body").click(function (z) {
- var y = z.target.className.split(" ");
- if ($.inArray("team-status", y) == -1 && $.inArray("team-status-toggle", y) == -1 && $(z.target).parents().index($(".team-status")) == -1 && $(z.target).parents(".team-status-toggle").length == 0) {
- w()
- }
- });
- $(".team-status #teamslider").each(function () {
- $(this).slimScrollHorizontal({
- width: "100%",
- alwaysVisible: true,
- color: "#fff",
- opacity: "0.5",
- size: "5px"
- })
- });
- var w = function (y) {
- $(".team-status").each(function () {
- var z = $(this);
- if (z.is(":visible")) {
- var A = x(y);
- if (A != ("#" + z.attr("id"))) {
- $(this).slideUp(200, function () {
- $(this).toggleClass("open");
- $(".team-status-toggle").each(function () {
- var B = x(this);
- if (B == ("#" + z.attr("id"))) {
- $(this).parent().removeClass("open")
- }
- })
- })
- }
- }
- })
- };
- var x = function (y) {
- var z = $(y).data("teamStatus");
- if (typeof z == "undefined") {
- z = "#team-status"
- }
- return z
- }
- }
- var c = function () {
- $(".team-status").each(function () {
- var x = $(this);
- x.css("position", "absolute").css("margin-top", "-1000px").show();
- var w = 0;
- $("ul li", this).each(function () {
- w += $(this).outerWidth(true) + 15
- });
- x.css("position", "relative").css("margin-top", "0").hide();
- $("ul", this).width(w)
- })
- };
-
- /*-----------------------------------------------------------------------------------*/
- /* Homepage tooltips
- /*-----------------------------------------------------------------------------------*/
- var handleHomePageTooltips = function () {
- //On Hover
- //Default tooltip (Top)
- $('.tip').tooltip();
- //Bottom tooltip
- $('.tip-bottom').tooltip({
- placement : 'bottom'
- });
- //Left tooltip
- $('.tip-left').tooltip({
- placement : 'left'
- });
- //Right tooltip
- $('.tip-right').tooltip({
- placement : 'right'
- });
- //On Focus
- //Default tooltip (Top)
- $('.tip-focus').tooltip({
- trigger: 'focus'
- });
- }
-
- /*-----------------------------------------------------------------------------------*/
- /* Box tools
- /*-----------------------------------------------------------------------------------*/
- var handleBoxTools = function () {
- //Collapse
- jQuery('.box .tools .collapse, .box .tools .expand').click(function () {
- var el = jQuery(this).parents(".box").children(".box-body");
- if (jQuery(this).hasClass("collapse")) {
- jQuery(this).removeClass("collapse").addClass("expand");
- var i = jQuery(this).children(".fa-chevron-up");
- i.removeClass("fa-chevron-up").addClass("fa-chevron-down");
- el.slideUp(200);
- } else {
- jQuery(this).removeClass("expand").addClass("collapse");
- var i = jQuery(this).children(".fa-chevron-down");
- i.removeClass("fa-chevron-down").addClass("fa-chevron-up");
- el.slideDown(200);
- }
- });
-
- /* Close */
- jQuery('.box .tools a.remove').click(function () {
- var removable = jQuery(this).parents(".box");
- if (removable.next().hasClass('box') || removable.prev().hasClass('box')) {
- jQuery(this).parents(".box").remove();
- } else {
- jQuery(this).parents(".box").parent().remove();
- }
- });
-
- /* Reload */
- jQuery('.box .tools a.reload').click(function () {
- var el = jQuery(this).parents(".box");
- App.blockUI(el);
- window.setTimeout(function () {
- App.unblockUI(el);
- }, 1000);
- });
- }
- /*-----------------------------------------------------------------------------------*/
- /* SlimScroll
- /*-----------------------------------------------------------------------------------*/
- var handleSlimScrolls = function () {
- if (!jQuery().slimScroll) {
- return;
- }
- $('.scroller').each(function () {
- $(this).slimScroll({
- size: '7px',
- color: '#a1b2bd',
- height: $(this).attr("data-height"),
- alwaysVisible: ($(this).attr("data-always-visible") == "1" ? true : false),
- railVisible: ($(this).attr("data-rail-visible") == "1" ? true : false),
- railOpacity: 0.1,
- disableFadeOut: true
- });
- });
- }
-
- /*-----------------------------------------------------------------------------------*/
- /* Bootbox alerts
- /*-----------------------------------------------------------------------------------*/
- var handleBootbox = function () {
- $(".basic-alert").click(function(){
- bootbox.alert("Hello World111111");
- });
- $(".confirm-dialog").click(function(){
- bootbox.confirm("Are you sure?", function(result){});
- });
- $(".multiple-buttons").click(function(){
- bootbox.dialog({
- message: "I am a custom dialog",
- title: "Custom title",
- buttons: {
- success: {
- label: "Success!",
- className: "btn-success",
- callback: function() {
- Example.show("great success");
- }
- },
- danger: {
- label: "Danger!",
- className: "btn-danger",
- callback: function() {
- Example.show("uh oh, look out!");
- }
- },
- main: {
- label: "Click ME!",
- className: "btn-primary",
- callback: function() {
- Example.show("Primary button");
- }
- }
- }
- });
- });
- $(".multiple-dialogs").click(function(){
- bootbox.alert("In 1 second a new modal will open");
- setTimeout(function() {
- bootbox.dialog({
- message: "Will you purchase this awesome theme",
- title: "Pop quiz",
- buttons: {
- success: {
- label: "Yes!",
- className: "btn-success",
- callback: function() {
- bootbox.alert("Congratulations! You made the right decision.", function(){
- $(".bootbox").modal("hide");
- });
- }
- },
- danger: {
- label: "No!",
- className: "btn-danger",
- callback: function() {
- bootbox.alert("Oops, we're sorry to hear that!", function(){
- $(".bootbox").modal("hide");
- });
-
- }
- },
- main: {
- label: "Click ME!",
- className: "btn-primary",
- callback: function() {
- bootbox.alert("Hello World", function(){
- $(".bootbox").modal("hide");
- });
- }
- }
- }
- });
- }, 1000);
- });
- $(".programmatic-close").click(function(){
- bootbox.alert("In 3 second this modal will close..");
- setTimeout(function() {
- $(".bootbox").modal("hide");
- }, 3000);
- });
-
- }
- /*-----------------------------------------------------------------------------------*/
- /* Popovers
- /*-----------------------------------------------------------------------------------*/
- var handlePopovers = function () {
- //Default (Right)
- $('.pop').popover();
- //Bottom
- $('.pop-bottom').popover({
- placement : 'bottom'
- });
- //Left
- $('.pop-left').popover({
- placement : 'left'
- });
- //Top
- $('.pop-top').popover({
- placement : 'top'
- });
- //Trigger hover
- $('.pop-hover').popover({
- trigger: 'hover'
- });
- }
-
- /*-----------------------------------------------------------------------------------*/
- /* Hubspot messenger
- /*-----------------------------------------------------------------------------------*/
- var handleMessenger = function () {
-
- //Normal
- $("#normal").click(function(){
- var mytheme = $('input[name=theme]:checked').val();
- var mypos = $('input[name=position]:checked').val();
- //Set theme
- Messenger.options = {
- extraClasses: 'messenger-fixed '+mypos,
- theme: mytheme
- }
- //Call
- Messenger().post({
- message:"This is a normal notification!",
- showCloseButton: true
- });
- });
- //Interactive
- $("#interactive").click(function(){
- var mytheme = $('input[name=theme]:checked').val();
- var mypos = $('input[name=position]:checked').val();
- //Set theme
- Messenger.options = {
- extraClasses: 'messenger-fixed '+mypos,
- theme: mytheme
- }
- var msg;
- msg = Messenger().post({
- message: 'Launching thermonuclear war...',
- type: 'info',
- actions: {
- cancel: {
- label: 'cancel launch',
- action: function() {
- return msg.update({
- message: 'Thermonuclear war averted',
- type: 'success',
- showCloseButton: true,
- actions: false
- });
- }
- }
- }
- });
- });
- //Timer
- $("#timer").click(function(){
- var mytheme = $('input[name=theme]:checked').val();
- var mypos = $('input[name=position]:checked').val();
- //Set theme
- Messenger.options = {
- extraClasses: 'messenger-fixed '+mypos,
- theme: mytheme
- }
- var i;
- i = 0;
- Messenger().run({
- errorMessage: 'Error destroying alien planet',
- successMessage: 'Alien planet destroyed!',
- showCloseButton: true,
- action: function(opts) {
- if (++i < 3) {
- return opts.error({
- status: 500,
- readyState: 0,
- responseText: 0
- });
- } else {
- return opts.success();
- }
- }
- });
- });
- //Prompts
- $("#prompts").click(function(){
- var mytheme = $('input[name=theme]:checked').val();
- var mypos = $('input[name=position]:checked').val();
- //Set theme
- Messenger.options = {
- extraClasses: 'messenger-fixed '+mypos,
- theme: mytheme
- }
- Messenger().run({
- successMessage: 'Data saved.',
- errorMessage: 'Error saving data',
- progressMessage: 'Saving data',
- showCloseButton: true,
- }, {
- url: 'http://www.example.com/data'
- });
- });
- }
- /*-----------------------------------------------------------------------------------*/
- /* Alerts
- /*-----------------------------------------------------------------------------------*/
- var handleAlerts = function () {
- $(".alert").alert();
- }
-
- /*-----------------------------------------------------------------------------------*/
- /* Magic Suggest
- /*-----------------------------------------------------------------------------------*/
- var handleMagicSuggest = function () {
- var jsonData = [];
- var cities = 'New York,Los Angeles,Chicago,Houston,Paris,Marseille,Toulouse,Lyon,Bordeaux,Philadelphia,Phoenix,San Antonio,San Diego,Dallas,San Jose,Jacksonville'.split(',');
- for(var i=0;i<cities.length;i++) jsonData.push({id:i,name:cities[i],status:i%2?'Already Visited':'Planned for visit',coolness:Math.floor(Math.random() * 10) + 1});
- var ms1 = $('#ms1').magicSuggest({
- data: jsonData,
- sortOrder: 'name',
- value: [0],
- selectionPosition: 'right',
- groupBy: 'status',
- maxDropHeight: 200
- });
- var ms2 = $('#ms2').magicSuggest({
- width: '80%',
- data: jsonData
- });
- var ms3 = $('#ms3').magicSuggest({
- selectionPosition: 'bottom',
- renderer: function(city){
- return '<div>' +
- '<div style="font-family: Arial; font-weight: bold">' + city.name + '</div>' +
- '<div><b>Cooooolness</b>: ' + city.coolness + '</div>' +
- '</div>';
- },
- minChars: 1,
- selectionStacked: true,
- data: jsonData
- });
- var ms4 = $('#ms4').magicSuggest({
- data: [{id:1,label:'one'}, {id:2,label:'two'}, {id:3,label:'three'}],
- displayField: 'label',
- value: [1,3]
- });
- var ms5 = $('#ms5').magicSuggest({
- width: '80%',
- data: 'marilyn@monroe.com,mother@teresa.com,john@kennedy.com,martin@luther.com,nelson@mandela.com,winston@churchill.com,bill@gates.com,muhammad@ali.com,mahatma@gandhi.com,margaret@thatcher.com,charles@gaulle.com,christopher@colombus.com,george@orwell.com,charles@darwin.com,elvis@presley.com,albert@einstein.com,paul@mccartney.com,queen@elizabeth.com,queen@victoria.com,john@keynes.com,mikhail@gorbachev.com,jawaharlal@nehru.com,leonardo@vinci.com,louis@pasteur.com,leo@tolstoy.com,pablo@picasso.com,vincent@gogh.com,franklin@roosevelt.com,john@paul.com,neil@armstrong.com,thomas@edison.com,rosa@parks.com,aung@kyi.com,lyndon@johnson.com,ludwig@beethoven.com,oprah@winfrey.com,indira@gandhi.com,eva@peron.com,benazir@bhutto.com,desmond@tutu.com,dalai@lama.com,walt@disney.com,peter@sellers.com,barack@obama.com,malcolm@x.com,richard@branson.com,jesse@owens.com,ernest@hemingway.com,john@lennon.com,henry@ford.com,haile@selassie.com,joseph@stalin.com,lord@baden.com,michael@jordon.com,george@bush.com,osama@laden.com,fidel@castro.com,oscar@wilde.com,coco@chanel.com,amelia@earhart.com,adolf@hitler.com,mary@magdalene.com,alfred@hitchcock.com,michael@jackson.com,mata@hari.com,emmeline@pankhurst.com,ronald@reagan.com,lionel@messi.com,babe@ruth.com,bob@geldof.com,leon@trotsky.com,roger@federer.com,sigmund@freud.com,woodrow@wilson.com,mao@zedong.com,katherine@hepburn.com,audrey@hepburn.com,david@beckham.com,tiger@woods.com,usain@bolt.com,bill@cosby.com,carl@lewis.com,prince@charles.com,jacqueline@onassis.com,billie@holiday.com,virginia@woolf.com,billie@king.com,kylie@minogue.com,anne@frank.com,emile@zatopek.com,lech@walesa.com,christiano@ronaldo.com,yoko@ono.com,julie@andrews.com,florence@nightingale.com,marie@curie.com,stephen@hawking.com,tim@lee.com,lady@gaga.com,lance@armstrong.com,jon@stewart.com,scarlett@johansson.com,larry@page.com,sergey@brin.com,roman@abramovich.com,rupert@murdoch.com,al@gore.com,sacha@baron.com,george@clooney.com,paul@krugman.com,jimmy@wales.com'
- });
- var ms6 = $('#ms6').magicSuggest({
- // will fetch data from options
- });
- var ms7 = $('#ms7').magicSuggest({
- data: jsonData,
- resultAsString: true,
- maxSelection: 1,
- maxSelectionRenderer: function(){}
- })
- }
- /*-----------------------------------------------------------------------------------*/
- /* Timeago
- /*-----------------------------------------------------------------------------------*/
- var handleTimeAgo = function () {
- jQuery(document).ready(function() {
- var curr_time = moment().format('YYYY-MM-DD HH:mm');
- var yesterday = moment().subtract('days', 1).format('MMM D, YYYY');
- $("#curr-time").html(curr_time);
- $("#curr-time").attr('title', curr_time);
- $("#curr-time").attr('data-original-title', curr_time);
- $("#yesterday").html(yesterday);
- $("#yesterday").attr('title', yesterday);
- $("#yesterday").attr('data-original-title', yesterday);
- jQuery("abbr.timeago").timeago();
- });
- }
- /*-----------------------------------------------------------------------------------*/
- /* Init Timeago
- /*-----------------------------------------------------------------------------------*/
- var initTimeAgo = function () {
- jQuery("abbr.timeago").timeago();
- }
- /*-----------------------------------------------------------------------------------*/
- /* Date & Color Picker
- /*-----------------------------------------------------------------------------------*/
- var handleDateColorpicker = function () {
- $(".datepicker").datepicker();
- $(".inlinepicker").datepicker({
- inline: true,
- showOtherMonths: true
- });
- $(".datepicker-fullscreen").pickadate();
- $(".timepicker-fullscreen").pickatime();
- //Color picker
- $('.colorpicker').colorpicker();
- var a = $("#color-pickers")[0].style;
- $("#colorpicker-event").colorpicker().on("changeColor", function (b) {
- a.backgroundColor = b.color.toHex()
- });
- }
- /*-----------------------------------------------------------------------------------*/
- /* Raty
- /*-----------------------------------------------------------------------------------*/
- var handleRaty = function () {
- $.fn.raty.defaults.path = 'js/jquery-raty/img';
- $('#score-demo').raty({ score: 3 });
- $('#number-demo').raty({ number: 10 });
- $('#readOnly-demo').raty({ readOnly: true, score: 2 });
- $('#halfShow-true-demo').raty({ score: 3.26 });
- $('#starHalf-demo').raty({
- path : 'js/jquery-raty/img',
- half : true,
- starOff : 'cookie-off.png',
- starOn : 'cookie-on.png',
- starHalf: 'cookie-half.png'
- });
- $('#star-off-and-star-on-demo').raty({
- path : 'js/jquery-raty/img',
- starOff: 'off.png',
- starOn : 'on.png'
- });
- $('#cancel-off-and-cancel-on-demo').raty({
- path : 'js/jquery-raty/img',
- cancel : true,
- cancelOff: 'cancel-custom-off.png',
- cancelOn : 'cancel-custom-on.png',
- starOn : 'star-on.png',
- starOff : 'star-off.png'
- });
- $('#size-demo').raty({
- path : 'js/jquery-raty/img',
- cancel : true,
- cancelOff: 'cancel-off-big.png',
- cancelOn : 'cancel-on-big.png',
- half : true,
- size : 24,
- starHalf : 'star-half-big.png',
- starOff : 'star-off-big.png',
- starOn : 'star-on-big.png'
- });
- $('#target-div-demo').raty({
- cancel: true,
- target: '#target-div-hint'
- });
- }
- /*-----------------------------------------------------------------------------------*/
- /* Stateful buttons
- /*-----------------------------------------------------------------------------------*/
- var handleStatefulButtons = function () {
- $(document).ready(function(){
- $("#btn-load").on("click",function(){
- var a=$(this);
- a.button("loading");
- setTimeout(function(){
- a.button("reset")}
- ,1500)}
- );
- $("#btn-load-complete").on("click",function(){
- var a=$(this);
- a.button("loading");
- setTimeout(function(){
- a.button("complete")}
- ,1500)}
- )}
- );
- }
- /*-----------------------------------------------------------------------------------*/
- /* Toggle buttons
- /*-----------------------------------------------------------------------------------*/
- var handleToggle = function () {
- $('.radio1').on('switch-change', function () {
- $('.radio1').bootstrapSwitch('toggleRadioState');
- });
- // or
- $('.radio1').on('switch-change', function () {
- $('.radio1').bootstrapSwitch('toggleRadioStateAllowUncheck');
- });
- // or
- $('.radio1').on('switch-change', function () {
- $('.radio1').bootstrapSwitch('toggleRadioStateAllowUncheck', false);
- });
- }
- /*-----------------------------------------------------------------------------------*/
- /* jQuery UI Sliders
- /*-----------------------------------------------------------------------------------*/
- var handleSliders = function () {
- function repositionTooltip( e, ui ){$
- var div = $(ui.handle).data("bs.tooltip").$tip[0];
- var pos = $.extend({}, $(ui.handle).offset(), { width: $(ui.handle).get(0).offsetWidth,
- height: $(ui.handle).get(0).offsetHeight
- });
-
- var actualWidth = div.offsetWidth;
-
- tp = {left: pos.left + pos.width / 2 - actualWidth / 2}
- $(div).offset(tp);
-
- $(div).find(".tooltip-inner").text( ui.value );
- }
-
- $("#slider").slider({ value: 15, slide: repositionTooltip, stop: repositionTooltip });
- $("#slider .ui-slider-handle:first").tooltip( {title: $("#slider").slider("value"), trigger: "manual"}).tooltip("show");
-
- $("#slider-default").slider();
-
- $("#slider-range").slider({
- range:true,min:0,max:500,values:[75,300]
- });
-
- $("#slider-range-min").slider({
- range:"min",value:37,min:1,max:700,slide:function(a,b){
- $("#slider-range-min-amount").text("$"+b.value)}
- });
-
- $("#slider-range-max").slider({
- range:"max",min:1,max:700,value:300,slide:function(a,b){
- $("#slider-range-max-amount").text("$"+b.value)}
- });
-
- $("#slider-vertical-multiple > span").each(function(){
- var a=parseInt($(this).text(),10);
- $(this).empty().slider({
- value:a,range:"min",animate:true,orientation:"vertical"}
- )}
- );
- $("#slider-vertical-range-min").slider({
- range:"min",value:400,min:1,max:600,orientation:"vertical"
- });
- $("#slider-horizontal-range-min").slider({
- range:"min",value:600,min:1,max:1000
- });
- }
- /*-----------------------------------------------------------------------------------*/
- /* jQuery UI Progress
- /*-----------------------------------------------------------------------------------*/
- var handleProgress = function () {
- $(document).ready(function(){
- jQuery.fn.anim_progressbar = function (aOptions) {
- // def values
- var iCms = 1000;
- var iMms = 60 * iCms;
- var iHms = 3600 * iCms;
- var iDms = 24 * 3600 * iCms;
- // def options
- var aDefOpts = {
- start: new Date(), // now
- finish: new Date().setTime(new Date().getTime() + 60 * iCms), // now + 60 sec
- interval: 100
- }
- var aOpts = jQuery.extend(aDefOpts, aOptions);
- var vPb = this;
- // each progress bar
- return this.each(
- function() {
- var iDuration = aOpts.finish - aOpts.start;
- // calling original progressbar
- $(vPb).children('.pbar').progressbar();
- // looping process
- var vInterval = setInterval(
- function(){
- var iLeftMs = aOpts.finish - new Date(); // left time in MS
- var iElapsedMs = new Date() - aOpts.start, // elapsed time in MS
- iDays = parseInt(iLeftMs / iDms), // elapsed days
- iHours = parseInt((iLeftMs - (iDays * iDms)) / iHms), // elapsed hours
- iMin = parseInt((iLeftMs - (iDays * iDms) - (iHours * iHms)) / iMms), // elapsed minutes
- iSec = parseInt((iLeftMs - (iDays * iDms) - (iMin * iMms) - (iHours * iHms)) / iCms), // elapsed seconds
- iPerc = (iElapsedMs > 0) ? iElapsedMs / iDuration * 100 : 0; // percentages
- // display current positions and progress
- $(vPb).children('.percent').html('<b>'+iPerc.toFixed(1)+'%</b>');
- $(vPb).children('.elapsed').html(iDays+' day '+iHours+' hr : '+iMin+' min : '+iSec+' sec remaining</b>');
- $(vPb).children('.pbar').children('.ui-progressbar-value').css('width', iPerc+'%');
- // in case of Finish
- if (iPerc >= 100) {
- clearInterval(vInterval);
- $(vPb).children('.percent').html('<b>100%</b>');
- $(vPb).children('.elapsed').html('Completed');
- }
- } ,aOpts.interval
- );
- }
- );
- }
- // default mode
- $('#progress1').anim_progressbar();
- // from second #5 till 15
- var iNow = new Date().setTime(new Date().getTime() + 5 * 1000); // now plus 5 secs
- var iEnd = new Date().setTime(new Date().getTime() + 15 * 1000); // now plus 15 secs
- $('#progress2').anim_progressbar({start: iNow, finish: iEnd, interval: 100});
- // we will just set interval of updating to 1 sec
- $('#progress3').anim_progressbar({interval: 1000});
- });
- }
- /*-----------------------------------------------------------------------------------*/
- /* jQuery Knob
- /*-----------------------------------------------------------------------------------*/
- var handleKnobs = function () {
- $(".knob").knob({
- change : function (value) {
- //console.log("change : " + value);
- },
- release : function (value) {
- //console.log(this.$.attr('value'));
- console.log("release : " + value);
- },
- cancel : function () {
- console.log("cancel : ", this);
- },
- draw : function () {
- // "tron" case
- if(this.$.data('skin') == 'tron') {
- var a = this.angle(this.cv) // Angle
- , sa = this.staruskyle // Previous start angle
- , sat = this.staruskyle // Start angle
- , ea // Previous end angle
- , eat = sat + a // End angle
- , r = 1;
- this.g.lineWidth = this.lineWidth;
- this.o.cursor
- && (sat = eat - 0.3)
- && (eat = eat + 0.3);
- if (this.o.displayPrevious) {
- ea = this.staruskyle + this.angle(this.v);
- this.o.cursor
- && (sa = ea - 0.3)
- && (ea = ea + 0.3);
- this.g.beginPath();
- this.g.strokeStyle = this.pColor;
- this.g.arc(this.xy, this.xy, this.radius - this.lineWidth, sa, ea, false);
- this.g.stroke();
- }
- this.g.beginPath();
- this.g.strokeStyle = r ? this.o.fgColor : this.fgColor ;
- this.g.arc(this.xy, this.xy, this.radius - this.lineWidth, sat, eat, false);
- this.g.stroke();
- this.g.lineWidth = 2;
- this.g.beginPath();
- this.g.strokeStyle = this.o.fgColor;
- this.g.arc( this.xy, this.xy, this.radius - this.lineWidth + 1 + this.lineWidth * 2 / 3, 0, 2 * Math.PI, false);
- this.g.stroke();
- return false;
- }
- }
- });
- }
-
- /*-----------------------------------------------------------------------------------*/
- /* Custom tabs
- /*-----------------------------------------------------------------------------------*/
- var handleCustomTabs = function () {
- var adjustMinHeight = function (y) {
- $(y).each(function () {
- var A = $($($(this).attr("href")));
- var z = $(this).parent().parent();
- if (z.height() > A.height()) {
- A.css("min-height", z.height())
- }
- })
- };
- $("body").on("click", '.nav.nav-tabs.tabs-left a[data-toggle="tab"], .nav.nav-tabs.tabs-right a[data-toggle="tab"]', function () {
- adjustMinHeight($(this))
- });
- adjustMinHeight('.nav.nav-tabs.tabs-left > li.active > a[data-toggle="tab"], .nav.nav-tabs.tabs-right > li.active > a[data-toggle="tab"]');
- if (location.hash) {
- var w = location.hash.substr(1);
- $('a[href="#' + w + '"]').click()
- }
- }
- /*-----------------------------------------------------------------------------------*/
- /* Fuel UX Tree
- /*-----------------------------------------------------------------------------------*/
- var handleTree = function () {
- $('#tree1').admin_tree({
- dataSource: treeDataSource ,
- multiSelect:true,
- loadingHTML:'<div class="tree-loading"><i class="fa fa-spinner fa-2x fa-spin"></i></div>',
- 'open-icon' : 'fa-minus',
- 'close-icon' : 'fa-plus',
- 'selectable' : true,
- 'selected-icon' : 'fa-check',
- 'unselected-icon' : 'fa-times'
- });
- $('#tree3').admin_tree({
- dataSource: treeDataSource3 ,
- multiSelect:true,
- loadingHTML:'<div class="tree-loading"><i class="fa fa-spinner fa-2x fa-spin"></i></div>',
- 'open-icon' : 'fa-minus-square',
- 'close-icon' : 'fa-plus-square',
- 'selectable' : true,
- 'selected-icon' : 'fa-check',
- 'unselected-icon' : 'fa-times'
- });
- $('#tree2').admin_tree({
- dataSource: treeDataSource2 ,
- loadingHTML:'<div class="tree-loading"><i class="fa fa-spinner fa-2x fa-spin"></i></div>',
- 'open-icon' : 'fa-folder-open',
- 'close-icon' : 'fa-folder',
- 'selectable' : false,
- 'selected-icon' : null,
- 'unselected-icon' : null
- });
-
-
- //To add font awesome support
- $('.tree').find('[class*="fa-"]').addClass("fa");
- }
-
- /*-----------------------------------------------------------------------------------*/
- /* Nestable Lists
- /*-----------------------------------------------------------------------------------*/
- var handleNestableLists = function () {
- var updateOutput = function(e)
- {
- var list = e.length ? e : $(e.target),
- output = list.data('output');
- if (window.JSON) {
- output.val(window.JSON.stringify(list.nestable('serialize')));//, null, 2));
- } else {
- output.val('JSON browser support required for this demo.');
- }
- };
- // activate Nestable for list 1
- $('#nestable').nestable({
- group: 1
- })
- .on('change', updateOutput);
-
- // activate Nestable for list 2
- $('#nestable2').nestable({
- group: 1
- })
- .on('change', updateOutput);
- // output initial serialised data
- updateOutput($('#nestable').data('output', $('#nestable-output')));
- updateOutput($('#nestable2').data('output', $('#nestable2-output')));
- $('#nestable-menu').on('click', function(e)
- {
- var target = $(e.target),
- action = target.data('action');
- if (action === 'expand-all') {
- $('.dd').nestable('expandAll');
- }
- if (action === 'collapse-all') {
- $('.dd').nestable('collapseAll');
- }
- });
- $('#nestable3').nestable();
- }
- /*-----------------------------------------------------------------------------------*/
- /* Table Cloth
- /*-----------------------------------------------------------------------------------*/
- var handleTablecloth = function () {
- $("#example-dark").tablecloth({
- theme: "dark"
- });
- $("#example-paper").tablecloth({
- theme:"paper",
- striped: true
- });
- $("#example-stats").tablecloth({
- theme:"stats",
- sortable:true,
- condensed:true,
- striped:true,
- clean:true
- });
- }
- /*-----------------------------------------------------------------------------------*/
- /* Data Tables
- /*-----------------------------------------------------------------------------------*/
- var handleDataTables = function () {
- $('#logotable').dataTable({
- "aaSorting": [[ 0, "asc" ]],
- "aoColumnDefs": [
- {
- 'sWidth': '5%',
- "aTargets": [0]
- },
- {
- 'sWidth': '10%',
- "aTargets": [1]
- },
- {
- 'sWidth': '60%',
- "aTargets": [2]
- },
- {
- 'sWidth': '25%',
- "aTargets": [3]
- }
- ],
- "sPaginationType": "bs_full",
- "oLanguage": {
- "sLengthMenu": "每页显示 _MENU_ 条记录",
- "sZeroRecords": "抱歉, 没有找到",
- "sInfo": "从 _START_ 到 _END_ /共 _TOTAL_ 条数据",
- "sInfoEmpty": "没有数据",
- "sInfoFiltered": "(从 _MAX_ 条数据中检索)",
- "oPaginate": {
- "sFirst": "首页",
- "sPrevious": "前一页",
- "sNext": "后一页",
- "sLast": "尾页"
- }
- }
- });
- $('#datatable').dataTable({
- "aaSorting": [[ 0, "asc" ]],
- "sPaginationType": "bs_full",
- "oLanguage": {
- "sLengthMenu": "每页显示 _MENU_ 条记录",
- "sZeroRecords": "抱歉, 没有找到",
- "sInfo": "从 _START_ 到 _END_ /共 _TOTAL_ 条数据",
- "sInfoEmpty": "没有数据",
- "sInfoFiltered": "(从 _MAX_ 条数据中检索)",
- "oPaginate": {
- "sFirst": "首页",
- "sPrevious": "前一页",
- "sNext": "后一页",
- "sLast": "尾页"
- }
- }
- });
- $('.datatable').each(function(){
- var datatable = $(this);
- // SEARCH - Add the placeholder for Search and Turn this into in-line form control
- var search_input = datatable.closest('.dataTables_wrapper').find('div[id$=_filter] input');
- search_input.attr('placeholder', 'Search');
- search_input.addClass('form-control input-sm');
- // LENGTH - Inline-Form control
- var length_sel = datatable.closest('.dataTables_wrapper').find('div[id$=_length] select');
- length_sel.addClass('form-control input-sm');
- });
- }
- var handleExampleTables = function () {
- $('#exampletable').dataTable({
- "aaSorting": [[ 0, "asc" ]],
- "aoColumnDefs": [
- {
- 'sWidth': '5%',
- "aTargets": [0]
- },
- {
- 'sWidth': '10%',
- "aTargets": [1]
- },
- {
- 'sWidth': '30%',
- "aTargets": [2]
- },
- {
- 'sWidth': '35%',
- "aTargets": [3]
- },
- {
- 'sWidth': '20%',
- "aTargets": [4]
- }
- ],
- "sPaginationType": "bs_full",
- "oLanguage": {
- "sLengthMenu": "每页显示 _MENU_ 条记录",
- "sZeroRecords": "抱歉, 没有找到",
- "sInfo": "从 _START_ 到 _END_ /共 _TOTAL_ 条数据",
- "sInfoEmpty": "没有数据",
- "sInfoFiltered": "(从 _MAX_ 条数据中检索)",
- "oPaginate": {
- "sFirst": "首页",
- "sPrevious": "前一页",
- "sNext": "后一页",
- "sLast": "尾页"
- }
- }
- });
- $('.datatable').each(function(){
- var datatable = $(this);
- // SEARCH - Add the placeholder for Search and Turn this into in-line form control
- var search_input = datatable.closest('.dataTables_wrapper').find('div[id$=_filter] input');
- search_input.attr('placeholder', 'Search');
- search_input.addClass('form-control input-sm');
- // LENGTH - Inline-Form control
- var length_sel = datatable.closest('.dataTables_wrapper').find('div[id$=_length] select');
- length_sel.addClass('form-control input-sm');
- });
- }
- var handleNewsTables = function () {
- $('#newstable').dataTable({
- "aaSorting": [[ 2, "desc" ]],
- "aoColumnDefs": [
- {
- 'sWidth': '10%',
- "aTargets": [0]
- },
- {
- 'sWidth': '40%',
- "aTargets": [1]
- },
- {
- 'sWidth': '30%',
- "aTargets": [2]
- },
- {
- 'sWidth': '20%',
- "aTargets": [3]
- }
- ],
- "sPaginationType": "bs_full",
- "oLanguage": {
- "sLengthMenu": "每页显示 _MENU_ 条记录",
- "sZeroRecords": "抱歉, 没有找到",
- "sInfo": "从 _START_ 到 _END_ /共 _TOTAL_ 条数据",
- "sInfoEmpty": "没有数据",
- "sInfoFiltered": "(从 _MAX_ 条数据中检索)",
- "oPaginate": {
- "sFirst": "首页",
- "sPrevious": "前一页",
- "sNext": "后一页",
- "sLast": "尾页"
- }
- }
- });
- $('.datatable').each(function(){
- var datatable = $(this);
- // SEARCH - Add the placeholder for Search and Turn this into in-line form control
- var search_input = datatable.closest('.dataTables_wrapper').find('div[id$=_filter] input');
- search_input.attr('placeholder', 'Search');
- search_input.addClass('form-control input-sm');
- // LENGTH - Inline-Form control
- var length_sel = datatable.closest('.dataTables_wrapper').find('div[id$=_length] select');
- length_sel.addClass('form-control input-sm');
- });
- }
- /*-----------------------------------------------------------------------------------*/
- /* Typeahead
- /*-----------------------------------------------------------------------------------*/
- var handleTypeahead = function () {
- $('#autocomplete-example').typeahead({
- name: 'countries',
- local: ["red", "blue", "green", "yellow", "brown", "black"]
- });
- }
- /*-----------------------------------------------------------------------------------*/
- /* Autosize
- /*-----------------------------------------------------------------------------------*/
- var handleAutosize = function () {
- $('textarea.autosize').autosize();
- $('textarea.autosize').addClass('textarea-transition');
- }
- /*-----------------------------------------------------------------------------------*/
- /* jquery Counatble
- /*-----------------------------------------------------------------------------------*/
- var handleCountable = function () {
- $('.countable').simplyCountable();
- }
- /*-----------------------------------------------------------------------------------*/
- /* Select2
- /*-----------------------------------------------------------------------------------*/
- var handleSelect2 = function () {
- function movieFormatResult(movie) {
- var markup = "<table class='movie-result'><tr>";
- if (movie.posters !== undefined && movie.posters.thumbnail !== undefined) {
- markup += "<td class='movie-image'><img src='" + movie.posters.thumbnail + "'/></td>";
- }
- markup += "<td class='movie-info'><div class='movie-title'>" + movie.title + "</div>";
- if (movie.critics_consensus !== undefined) {
- markup += "<div class='movie-synopsis'>" + movie.critics_consensus + "</div>";
- }
- else if (movie.synopsis !== undefined) {
- markup += "<div class='movie-synopsis'>" + movie.synopsis + "</div>";
- }
- markup += "</td></tr></table>"
- return markup;
- }
- function movieFormatSelection(movie) {
- return movie.title;
- }
- /* Basic */
- $("#e1").select2();
- /* Multi-Value Select Boxes */
- $("#e2").select2();
- /* With Placeholders */
- $("#e3").select2({
- placeholder: "Select a State",
- allowClear: true
- });
- /* With Placeholders */
- $("#e4").select2({
- placeholder: "Select a State"
- });
- /* Minimum Input */
- $("#e5").select2({
- placeholder: "Select 2 characters",
- minimumInputLength: 2
- });
- /* Maximum Selection Size */
- $("#e6").select2({
- placeholder: "Select a maximum of 3 states",
- maximumSelectionSize: 3
- });
- /* Loading Remote Data */
- $("#e7").select2({
- placeholder: "Search for a movie",
- minimumInputLength: 1,
- ajax: { // instead of writing the function to execute the request we use Select2's convenient helper
- url: "http://api.rottentomatoes.com/api/public/v1.0/movies.json",
- dataType: 'jsonp',
- data: function (term, page) {
- return {
- q: term, // search term
- page_limit: 10,
- apikey: "uekzdmffsrmqzwdtcgmc5yu9" //please do not copy API. Use your own. Copying will be treated as a violation - usky Admin Author
- };
- },
- results: function (data, page) { // parse the results into the format expected by Select2.
- // since we are using custom formatting functions we do not need to alter remote JSON data
- return {results: data.movies};
- }
- },
- initSelection: function(element, callback) {
- // the input tag has a value attribute preloaded that points to a preselected movie's id
- // this function resolves that id attribute to an object that select2 can render
- // using its formatResult renderer - that way the movie name is shown preselected
- var id=$(element).val();
- if (id!=="") {
- $.ajax("http://api.rottentomatoes.com/api/public/v1.0/movies/"+id+".json", {
- data: {
- apikey: "uekzdmffsrmqzwdtcgmc5yu9" //please do not copy API. Use your own. Copying will be treated as a violation - usky Admin Author
- },
- dataType: "jsonp"
- }).done(function(data) { callback(data); });
- }
- },
- formatResult: movieFormatResult, // omitted for brevity, see the source of this page
- formatSelection: movieFormatSelection, // omitted for brevity, see the source of this page
- dropdownCssClass: "bigdrop", // apply css that makes the dropdown taller
- escapeMarkup: function (m) { return m; } // we do not want to escape markup since we are displaying html in results
- });
- /* Tagging Support */
- $("#e8").select2({
- tags:["red", "green", "blue"]
- });
- }
- /*-----------------------------------------------------------------------------------*/
- /* Uniform
- /*-----------------------------------------------------------------------------------*/
- var handleUniform = function () {
- $(".uniform").uniform();
- }
- /*-----------------------------------------------------------------------------------*/
- /* All Checkboxes
- /*-----------------------------------------------------------------------------------*/
- var handleAllUniform = function () {
- $("select, input[type='checkbox']").uniform();
- }
- /*-----------------------------------------------------------------------------------*/
- /* BT Wysiwyg
- /*-----------------------------------------------------------------------------------*/
- var handleWysiwyg = function () {
- /* Init Bootstrap WYSIWYG */
- function initToolbarBootstrapBindings() {
- var fonts = ['Serif', 'Sans', 'Arial', 'Arial Black', 'Courier',
- 'Courier New', 'Comic Sans MS', 'Helvetica', 'Impact', 'Lucida Grande', 'Lucida Sans', 'Tahoma', 'Times',
- 'Times New Roman', 'Verdana'],
- fontTarget = $('[title=Font]').siblings('.dropdown-menu');
- $.each(fonts, function (idx, fontName) {
- fontTarget.append($('<li><a data-edit="fontName ' + fontName +'" style="font-family:\''+ fontName +'\'">'+fontName + '</a></li>'));
- });
- $('a[title]').tooltip({container:'body'});
- $('.dropdown-menu input').click(function() {return false;})
- .change(function () {$(this).parent('.dropdown-menu').siblings('.dropdown-toggle').dropdown('toggle');})
- .keydown('esc', function () {this.value='';$(this).change();});
- $('[data-role=magic-overlay]').each(function () {
- var overlay = $(this), target = $(overlay.data('target'));
- overlay.css('opacity', 0).css('position', 'absolute').offset(target.offset()).width(target.outerWidth()).height(target.outerHeight());
- });
- if ("onwebkitspeechchange" in document.createElement("input")) {
- var editorOffset = $('#editor').offset();
- $('#voiceBtn').css('position','absolute').offset({top: editorOffset.top, left: editorOffset.left+$('#editor').innerWidth()-35});
- } else {
- $('#voiceBtn').hide();
- }
- };
- function showErrorAlert (reason, detail) {
- var msg='';
- if (reason==='unsupported-file-type') { msg = "Unsupported format " +detail; }
- else {
- console.log("error uploading file", reason, detail);
- }
- $('<div class="alert"> <button type="button" class="close" data-dismiss="alert">×</button>'+
- '<strong>File upload error</strong> '+msg+' </div>').prependTo('#alerts');
- };
- initToolbarBootstrapBindings();
- $('#editor').wysiwyg({ fileUploadError: showErrorAlert} );
- /* Disable auto-inline */
- CKEDITOR.disableAutoInline = true;
- }
- /*-----------------------------------------------------------------------------------*/
- /* Dropzone
- /*-----------------------------------------------------------------------------------*/
- var handleDropzone = function () {
- try {
- $(".dropzone").dropzone({
- paramName: "file", // The name that will be used to transfer the file
- maxFilesize: 0.5, // MB
-
- addRemoveLinks : true,
- dictResponseError: 'Error while uploading file!',
-
- //change the previewTemplate to use Bootstrap progress bars
- previewTemplate: "<div class=\"dz-preview dz-file-preview\">\n <div class=\"dz-details\">\n <div class=\"dz-filename\"><span data-dz-name></span></div>\n <div class=\"dz-size\" data-dz-size></div>\n <img data-dz-thumbnail />\n </div>\n <div class=\"progress progress-sm progress-striped active\"><div class=\"progress-bar progress-bar-success\" data-dz-uploadprogress></div></div>\n <div class=\"dz-success-mark\"><span></span></div>\n <div class=\"dz-error-mark\"><span></span></div>\n <div class=\"dz-error-message\"><span data-dz-errormessage></span></div>\n</div>"
- });
- } catch(e) {
- alert('Dropzone.js does not support older browsers!');
- }
- }
- /*-----------------------------------------------------------------------------------*/
- /* Justgage
- /*-----------------------------------------------------------------------------------*/
- var handleGage = function () {
- var g1, g2, g3, g4, g5, g6;
-
- window.onload = function(){
- var g1 = new JustGage({
- id: "g1",
- value: getRandomInt(0, 100),
- min: 0,
- max: 100,
- title: "Custom Width",
- label: "",
- gaugeWidthScale: 0.2
- });
-
- var g2 = new JustGage({
- id: "g2",
- value: getRandomInt(0, 100),
- min: 0,
- max: 100,
- title: "Custom Shadow",
- label: "",
- shadowOpacity: 1,
- shadowSize: 0,
- shadowVerticalOffset: 4
- });
-
- var g3 = new JustGage({
- id: "g3",
- value: getRandomInt(0, 100),
- min: 0,
- max: 100,
- title: "Custom Colors",
- label: "",
- levelColors: [Theme.colors.red, Theme.colors.yellow, Theme.colors.green]
- });
-
- var g4 = new JustGage({
- id: "g4",
- value: getRandomInt(0, 100),
- min: 0,
- max: 100,
- title: "Hide Labels",
- showMinMax: false
- });
-
-
- var g5 = new JustGage({
- id: "g5",
- value: getRandomInt(0, 100),
- min: 0,
- max: 100,
- title: "Animation Type",
- label: "",
- startAnimationTime: 2000,
- startAnimationType: ">",
- refreshAnimationTime: 1000,
- refreshAnimationType: "bounce"
- });
-
- var g6 = new JustGage({
- id: "g6",
- value: getRandomInt(0, 100),
- min: 0,
- max: 100,
- title: "Minimal",
- label: "",
- showMinMax: false,
- gaugeColor: "#E6E6E6",
- levelColors: ["#555555"],
- showInnerShadow: false,
- startAnimationTime: 1,
- startAnimationType: "linear",
- refreshAnimationTime: 1,
- refreshAnimationType: "linear"
- });
-
- setInterval(function() {
- g1.refresh(getRandomInt(0, 100));
- g2.refresh(getRandomInt(0, 100));
- g3.refresh(getRandomInt(0, 100));
- g4.refresh(getRandomInt(0, 100));
- g5.refresh(getRandomInt(0, 100));
- g6.refresh(getRandomInt(0, 100));
- }, 2500);
- };
- }
- /*-----------------------------------------------------------------------------------*/
- /* Sparklines
- /*-----------------------------------------------------------------------------------*/
- var handleSparkline = function () {
- //Sparkline bar
- $(".sparkline").each(function() {
- var barSpacing, barWidth, color, height;
- color = $(this).attr("data-color") || "red";
- height = "18px";
- if ($(this).hasClass("big")) {
- barWidth = "5px";
- barSpacing = "2px";
- height = "40px";
- }
- return $(this).sparkline("html", {
- type: "bar",
- barColor: Theme.colors[color],
- height: height,
- barWidth: barWidth,
- barSpacing: barSpacing,
- zeroAxis: false
- });
- });
- //Sparkline Pie
- $(".sparklinepie").each(function() {
- var height;
- height = "50px";
- if ($(this).hasClass("big")) {
- height = "70px";
- }
- return $(this).sparkline("html", {
- type: "pie",
- height: height,
- sliceColors: [Theme.colors.blue, Theme.colors.red, Theme.colors.green, Theme.colors.orange]
- });
- });
- //Sparkline Line
- $(".linechart").each(function() {
- var height;
- height = "18px";
- if ($(this).hasClass("linechart-lg")) {
- height = "30px";
- }
- return $(this).sparkline("html", {
- type: "line",
- height: height,
- width: "150px",
- minSpotColor: Theme.colors.red,
- maxSpotColor: Theme.colors.green,
- spotRadius: 3,
- lineColor: Theme.colors.primary,
- fillColor: "rgba(94,135,176,0.1)",
- lineWidth: 1.2,
- highlightLineColor: Theme.colors.red,
- highlightSpotColor: Theme.colors.yellow
- });
- });
- }
-
- /*-----------------------------------------------------------------------------------*/
- /* Handle hover in gallery
- /*-----------------------------------------------------------------------------------*/
- var handleHover = function () {
- $('.filter-content').hover(function() {
- var hoverContent = $(this).children('.hover-content');
- hoverContent.removeClass('fadeOut').addClass('animated fadeIn').show();
- }, function() {
- var hoverContent = $(this).children('.hover-content');
- hoverContent.removeClass('fadeIn').addClass('fadeOut');
- });
- }
- /*-----------------------------------------------------------------------------------*/
- /* Handle Colorbox
- /*-----------------------------------------------------------------------------------*/
- var handleColorbox = function () {
- $('.colorbox-button').colorbox({rel:'colorbox-button',maxWidth:'95%', maxHeight:'95%'});
- /* Colorbox resize function */
- var resizeTimer;
- function resizeColorBox()
- {
- if (resizeTimer) clearTimeout(resizeTimer);
- resizeTimer = setTimeout(function() {
- var myWidth = 442, percentageWidth = .95;
- if (jQuery('#cboxOverlay').is(':visible')) {
- $.colorbox.resize({ width: ( $(window).width() > ( myWidth+20) )? myWidth : Math.round( $(window).width()*percentageWidth ) });
- $('.cboxPhoto').css( {
- width: $('#cboxLoadedContent').innerWidth(),
- height: 'auto'
- });
- $('#cboxLoadedContent').height( $('.cboxPhoto').height() );
- $.colorbox.resize();
- }
- }, 300)
- }
- // Resize Colorbox when resizing window or changing mobile device orientation
- jQuery(window).resize(resizeColorBox);
- window.addEventListener("orientationchange", resizeColorBox, false);
- }
- /*-----------------------------------------------------------------------------------*/
- /* Handle Backstretch
- /*-----------------------------------------------------------------------------------*/
- var handleBackstretch = function () {
- // $.backstretch([
- // "/usky/assets/admin/img/login/1.jpg"
- // , "/usky/assets/admin/img/login/2.jpg"
- // , "/usky/assets/admin/img/login/3.jpg"
- // , "/usky/assets/admin/img/login/4.jpg"
- // ], {duration: 3000, fade: 750});
- $.backstretch([
- "/assets/admin/img/login/1.jpg"
- , "/assets/admin/img/login/2.jpg"
- , "/assets/admin/img/login/3.jpg"
- , "/assets/admin/img/login/4.jpg"
- ], {duration: 3000, fade: 750});
- }
- /*-----------------------------------------------------------------------------------*/
- /* Handle Chat
- /*-----------------------------------------------------------------------------------*/
- var handleChat = function (elem) {
- var append = function() {
- //Check if chat is empty
- var input = $('.'+elem+' .chat-form input');
- var text = input.val();
- if (text.length == 0) {
- return;
- }
-
- //Get time
- var curr_time = moment().format('YYYY-MM-DD HH:mm:ss');
-
- var msg = '';
- msg +='<li class="animated fadeInLeft media">';
- msg += '<a class="pull-right" href="#">';
- msg += '<img class="media-object" alt="Generic placeholder image" src="img/chat/headshot2.jpg">';
- msg += '</a>';
- msg += '<div class="pull-right media-body chat-pop mod">';
- msg += '<h4 class="media-heading">You <span class="pull-left"><abbr id="curr-time" class="timeago" title="'+curr_time+'" >'+curr_time+'</abbr> <i class="fa fa-clock-o"></i></span></h4>';
- msg += text;
- msg += '</div>';
- msg +='</li>';
-
- var list = $('.'+elem+' .chat-list');
- list.append(msg);
- jQuery("abbr.timeago").timeago();
- input.val("");
- $('.'+elem+' .scroller').slimScroll({
- scrollTo: list.height()
- });
- }
- //If button is pressed
- $('.'+elem+' .chat-form .btn').click(function(e){
- e.preventDefault();
- append();
- });
-
- var input = $('.'+elem+' .chat-form input');
- //If Enter is pressed
- input.keypress(function (e) {
- if (e.which == 13) {
- append();
- return false;
- }
- });
- }
- /*-----------------------------------------------------------------------------------*/
- /* Handle Timeline
- /*-----------------------------------------------------------------------------------*/
- var handleTimeline = function () {
- createStoryJS({
- type: 'timeline',
- width: '100%',
- height: '600',
- source: 'js/timelinejs/example_json.json',
- embed_id: 'my-timeline',
- debug: true,
- css: 'js/timelinejs/css/timeline.css',
- js: 'js/timelinejs/js/timeline-min.js'
- });
- }
- /*-----------------------------------------------------------------------------------*/
- /* Handle Slidernav
- /*-----------------------------------------------------------------------------------*/
- var handleSliderNav = function () {
- $('#address-book').sliderNav();
-
- $('#address-book .slider-content ul li ul li a').click(function(e){
- e.preventDefault();
- var contact_card = $('#contact-card');
- //Get the name clicked on
- var name = $(this).text();
- //Set the name
- $('#contact-card .panel-title').html(name);
- $('#contact-card #card-name').html(name);
- //Randomize the image
- var img_id = Math.floor(Math.random() * (5 - 1 + 1)) + 1;
- //Set the image
- $('#contact-card .headshot img').attr('src', 'img/addressbook/'+img_id+'.jpg');
- contact_card.removeClass('animated fadeInUp').addClass('animated fadeInUp');
- var wait = window.setTimeout( function(){
- contact_card.removeClass('animated fadeInUp')},
- 1300
- );
- });
- }
- /*-----------------------------------------------------------------------------------*/
- /* Handle Active Toggle
- /*-----------------------------------------------------------------------------------*/
- var handleActiveToggle = function () {
- $('#list-toggle .list-group a').click(function(){
- $('#list-toggle .list-group > a.active').removeClass('active');
- $(this).addClass('active');
- })
- }
- /*-----------------------------------------------------------------------------------*/
- /* Handle Box Sortable
- /*-----------------------------------------------------------------------------------*/
- var handleBoxSortable = function () {
- $('.box-container').sortable({
- connectWith: '.box-container',
- items:'> .box',
- opacity:0.8,
- revert:true,
- forceHelperSize:true,
- placeholder: 'box-placeholder',
- forcePlaceholderSize:true,
- tolerance:'pointer'
- });
- }
- /*-----------------------------------------------------------------------------------*/
- /* Handles the go to top button at the footer
- /*-----------------------------------------------------------------------------------*/
- var handleGoToTop = function () {
- $('.footer-tools').on('click', '.go-top', function (e) {
- App.scrollTo();
- e.preventDefault();
- });
- }
- /*-----------------------------------------------------------------------------------*/
- /* Handles navbar fixed top
- /*-----------------------------------------------------------------------------------*/
- var handleNavbarFixedTop = function () {
- if(is_mobile && is_fixed_header) {
- //Manage margin top
- $('#main-content').addClass('margin-top-100');
- }
- if(!(is_mobile) && is_fixed_header){
- //Manage margin top
- $('#main-content').removeClass('margin-top-100').addClass('margin-top-50');
- }
- }
- /*-----------------------------------------------------------------------------------*/
- /* Handles flot charts in dashboard
- /*-----------------------------------------------------------------------------------*/
- var handleDashFlotCharts = function () {
- function chartMonth() {
- var data1 = [[0, 1.5],[1, 2], [2, 1], [3, 1.5], [4, 2.5],[5, 2], [6, 2], [7, 0.5], [8, 1], [9, 1.5], [10, 2],[11, 2.5], [12, 2], [13, 1.5], [14, 2.8], [15, 2],[16, 3], [17, 2], [18, 2.5], [19, 3],[20, 2.5], [21, 2], [22, 1.5], [23, 2.5], [24, 2], [25, 1.5],[26, 1], [27, 0.5], [28, 1], [29, 1],[30, 1.5], [31, 1]];
- var data2 = [[0, 2.5],[1, 3.5], [2, 2], [3, 3], [4, 4],[5, 3.5], [6, 3.5], [7, 1], [8, 2], [9, 3], [10, 4],[11, 5], [12, 4], [13, 3], [14, 5], [15, 3.5],[16, 5], [17, 4], [18, 5], [19, 6],[20, 5], [21, 4], [22, 3], [23, 5], [24, 4], [25, 3],[26, 2], [27, 1], [28, 2], [29, 2],[30, 3], [31, 2]];
-
- var plot = $.plot($("#chart-dash"), [{
- data: data2,
- label: "Pageviews",
- bars: {
- show: true,
- fill: true,
- barWidth: 0.4,
- align: "center",
- lineWidth: 13
- }
- }, {
- data: data1,
- label: "Visits",
- lines: {
- show: true,
- lineWidth: 2
- },
- points: {
- show: true,
- lineWidth: 2,
- fill: true
- },
- shadowSize: 0
- }, {
- data: data1,
- label: "Visits",
- lines: {
- show: true,
- lineWidth: 1,
- fill: true,
- fillColor: {
- colors: [{
- opacity: 0.05
- }, {
- opacity: 0.01
- }
- ]
- }
- },
- points: {
- show: true,
- lineWidth: 0.5,
- fill: true
- },
- shadowSize: 0
- }], {
- grid: {
- hoverable: true,
- clickable: true,
- tickColor: "#f7f7f7",
- borderWidth: 0,
- labelMargin: 10,
- margin: {
- top: 0,
- left: 5,
- bottom: 0,
- right: 0
- }
- },
- legend: {
- show: false
- },
- colors: ["rgba(109,173,189,0.5)", "#70AFC4", "#DB5E8C"],
-
- xaxis: {
- ticks: 5,
- tickDecimals: 0,
- tickColor: "#fff"
- },
- yaxis: {
- ticks: 3,
- tickDecimals: 0
- },
- });
- function showTooltip(x, y, contents) {
- $('<div id="tooltip">' + contents + '</div>').css({
- position: 'absolute',
- display: 'none',
- top: y + 5,
- left: x + 15,
- border: '1px solid #333',
- padding: '4px',
- color: '#fff',
- 'border-radius': '3px',
- 'background-color': '#333',
- opacity: 0.80
- }).appendTo("body").fadeIn(200);
- }
- var previousPoint = null;
- $("#chart-dash").bind("plothover", function (event, pos, item) {
- $("#x").text(pos.x.toFixed(2));
- $("#y").text(pos.y.toFixed(2));
- if (item) {
- if (previousPoint != item.dataIndex) {
- previousPoint = item.dataIndex;
- $("#tooltip").remove();
- var x = item.datapoint[0].toFixed(2),
- y = item.datapoint[1].toFixed(2);
- showTooltip(item.pageX, item.pageY,
- item.series.label + " of " + x + " = " + y);
- }
- } else {
- $("#tooltip").remove();
- previousPoint = null;
- }
- });
- }
-
- //Select chart
- function chart_select() {
- // setup plot
- function getData(x1, x2) {
- var d = [];
- for (var i = 0; i <= 100; ++i) {
- var x = x1 + i * (x2 - x1) / 100;
- d.push([x, Math.cos(x * Math.sin(x))]);
- }
- return [
- { label: "cos(x sin(x))", data: d }
- ];
- }
- var options = {
- grid: {
- hoverable: true,
- clickable: true,
- tickColor: "#f7f7f7",
- borderWidth: 0,
- labelMargin: 10,
- margin: {
- top: 0,
- left: 5,
- bottom: 0,
- right: 0
- }
- },
- legend: {
- show: false
- },
- series: {
- lines: {
- show: true
- },
- shadowSize: 0,
- points: {
- show: true
- }
- },
- colors: ["#D9534F"],
- yaxis: {
- ticks: 10
- },
- selection: {
- mode: "xy",
- color: "#F1ADAC"
- }
- };
- var startData = getData(0, 3 * Math.PI);
- var plot = $.plot("#placeholder", startData, options);
- // Create the overview plot
- var overview = $.plot($("#overview"), startData, {
- legend: {
- show: false
- },
- series: {
- lines: {
- show: true,
- lineWidth: 1
- },
- shadowSize: 0
- },
- xaxis: {
- ticks: 4
- },
- yaxis: {
- ticks: 3,
- min: -2,
- max: 2
- },
- colors: ["#D9534F"],
- grid: {
- color: "#999",
- borderWidth: 0,
- },
- selection: {
- mode: "xy",
- color: "#F1ADAC"
- }
- });
- // now connect the two
- $("#placeholder").bind("plotselected", function (event, ranges) {
- // clamp the zooming to prevent eternal zoom
- if (ranges.xaxis.to - ranges.xaxis.from < 0.00001) {
- ranges.xaxis.to = ranges.xaxis.from + 0.00001;
- }
- if (ranges.yaxis.to - ranges.yaxis.from < 0.00001) {
- ranges.yaxis.to = ranges.yaxis.from + 0.00001;
- }
- // do the zooming
- plot = $.plot("#placeholder", getData(ranges.xaxis.from, ranges.xaxis.to),
- $.extend(true, {}, options, {
- xaxis: { min: ranges.xaxis.from, max: ranges.xaxis.to },
- yaxis: { min: ranges.yaxis.from, max: ranges.yaxis.to }
- })
- );
- // don't fire event on the overview to prevent eternal loop
- overview.setSelection(ranges, true);
- });
- $("#overview").bind("plotselected", function (event, ranges) {
- plot.setSelection(ranges);
- });
- // Add the Flot version string to the footer
- $("#footer").prepend("Flot " + $.plot.version + " – ");
- }
-
- //Revenue chart
- function chart_revenue() {
- var likes = [[1, Math.random()*100], [2, Math.random()*100], [3, Math.random()*100], [4, Math.random()*100],[5,Math.random()*100],[6, Math.random()*100],[7, Math.random()*100],[8, Math.random()*100],[9, Math.random()*100],[10, Math.random()*100],[11, Math.random()*100],[12, Math.random()*100]];
-
- var chartColor = $(this).parent().parent().css("color");
-
- var plot = $.plot($("#chart-revenue"),
- [ { data: likes} ], {
- series: {
- label: "Revenue",
- lines: {
- show: true,
- lineWidth: 3,
- fill: false
- },
- points: {
- show: true,
- lineWidth: 3,
- fill: true,
- fillColor: chartColor
- },
- shadowSize: 0
- },
- grid: { hoverable: true,
- clickable: true,
- tickColor: "rgba(255,255,255,.15)",
- borderColor: "rgba(255,255,255,0)"
- },
- colors: ["#fff"],
- xaxis: {
- font: {
- color: "#fff"
- },
- ticks:6,
- tickDecimals: 0,
- tickColor: chartColor,
- },
- yaxis: {
- font: {
- color: "#fff"
- },
- ticks:4,
- tickDecimals: 0,
- autoscaleMargin: 0.000001
- },
- legend: {
- show: false
- }
- });
- function showTooltip(x, y, contents) {
- $('<div id="tooltip">' + contents + '</div>').css( {
- position: 'absolute',
- display: 'none',
- top: y + 5,
- left: x + 5,
- border: '1px solid #fdd',
- padding: '2px',
- 'background-color': '#dfeffc',
- opacity: 0.80
- }).appendTo("body").fadeIn(200);
- }
- var previousPoint = null;
- $("#chart-revenue").bind("plothover", function (event, pos, item) {
- $("#x").text(pos.x.toFixed(2));
- $("#y").text(pos.y.toFixed(2));
- if (item) {
- if (previousPoint != item.dataIndex) {
- previousPoint = item.dataIndex;
- $("#tooltip").remove();
- var x = item.datapoint[0].toFixed(2),
- y = item.datapoint[1].toFixed(2);
- showTooltip(item.pageX, item.pageY,
- item.series.label + " on " + x + " = " + y);
- }
- }
- else {
- $("#tooltip").remove();
- previousPoint = null;
- }
- });
- }
-
- //Run the charts
- chartMonth();
- chart_select();
- chart_revenue();
-
- //Pie 1
- $('#dash_pie_1').easyPieChart({
- easing: 'easeOutBounce',
- onStep: function(from, to, percent) {
- $(this.el).find('.percent').text(Math.round(percent)+"%");
- },
- lineWidth: 6,
- barColor: Theme.colors.purple
- });
- var chart1 = window.chart = $('#dash_pie_1').data('easyPieChart');
- //Pie 2
- $('#dash_pie_2').easyPieChart({
- easing: 'easeOutBounce',
- onStep: function(from, to, percent) {
- $(this.el).find('.percent').text(Math.round(percent)+"%");
- },
- lineWidth: 6,
- barColor: Theme.colors.yellow
- });
- var chart2 = window.chart = $('#dash_pie_2').data('easyPieChart');
- //Pie 3
- $('#dash_pie_3').easyPieChart({
- easing: 'easeOutBounce',
- onStep: function(from, to, percent) {
- $(this.el).find('.percent').text(Math.round(percent)+"%");
- },
- lineWidth: 6,
- barColor: Theme.colors.pink
- });
- var chart3 = window.chart = $('#dash_pie_3').data('easyPieChart');
-
- //Update the charts
- $('.js_update').on('click', function() {
- chart1.update(Math.random()*100);
- chart2.update(Math.random()*100);
- chart3.update(Math.random()*100);
- chart_revenue();
- });
- }
- /*-----------------------------------------------------------------------------------*/
- /* Handles vertically growing bars
- /*-----------------------------------------------------------------------------------*/
- var handleVerticalChart = function () {
- if($('.verticalChart')) {
- $('.singleBar').each(function(){
- var percent = $(this).find('.value span').html();
- $(this).find('.value').animate({height:percent}, 2000, function() {
- $(this).find('span').fadeIn();
- });
- });
- }
- }
- /*-----------------------------------------------------------------------------------*/
- /* Handles theme skin switches
- /*-----------------------------------------------------------------------------------*/
- // var handleThemeSkins = function () {
- // // Handle theme colors
- // var setSkin = function (color) {
- // $('#skin-switcher').attr("href", "css/themes/" + color + ".css");
- // $.cookie('skin_color', color);
- // }
- // $('ul.skins > li a').click(function () {
- // var color = $(this).data("skin");
- // setSkin(color);
- // });
-
- // //Check which theme skin is set
- // if ($.cookie('skin_color')) {
- // setSkin($.cookie('skin_color'));
- // }
- // }
- /*-----------------------------------------------------------------------------------*/
- /* Handles Gritter on Load
- /*-----------------------------------------------------------------------------------*/
- var handleGritter = function () {
- if ($.cookie('gritter_show')) {
- return;
- }
- $.cookie('gritter_show', 1);
- setTimeout(function () {
- var unique_id = $.gritter.add({
- // (string | mandatory) the heading of the notification
- title: 'Welcome to usky Admin!',
- // (string | mandatory) the text inside the notification
- text: 'Cloud is a feature-rich Responsive Admin Dashboard Template with a wide array of plugins!',
- // (string | optional) the image to display on the left
- image: 'img/gritter/cloud.png',
- // (bool | optional) if you want it to fade out on its own or just sit there
- sticky: true,
- // (int | optional) the time you want it to be alive for before fading out
- time: '',
- // (string | optional) the class name you want to apply to that specific message
- class_name: 'my-sticky-class'
- });
- // You can have it return a unique id, this can be used to manually remove it later using
- setTimeout(function () {
- $.gritter.remove(unique_id, {
- fade: true,
- speed: 'slow'
- });
- }, 12000);
- }, 2000);
- setTimeout(function () {
- var unique_id = $.gritter.add({
- // (string | mandatory) the heading of the notification
- title: 'Customize usky Admin!',
- // (string | mandatory) the text inside the notification
- text: 'usky Admin is easily customizable, lightweight and has a great User Experience.',
- // (string | optional) the image to display on the left
- image: 'img/gritter/settings.png',
- // (bool | optional) if you want it to fade out on its own or just sit there
- sticky: true,
- // (int | optional) the time you want it to be alive for before fading out
- time: '',
- // (string | optional) the class name you want to apply to that specific message
- class_name: 'my-sticky-class'
- });
- // You can have it return a unique id, this can be used to manually remove it later using
- setTimeout(function () {
- $.gritter.remove(unique_id, {
- fade: true,
- speed: 'slow'
- });
- }, 13000);
- }, 8000);
- setTimeout(function () {
- $.extend($.gritter.options, {
- position: 'top-left'
- });
- var unique_id = $.gritter.add({
- position: 'top-left',
- // (string | mandatory) the heading of the notification
- title: 'Buy usky Admin!',
- // (string | mandatory) the text inside the notification
- text: 'Purchase usky Admin theme and get access to future updates at no extra cost. Buy now!',
- // (string | optional) the image to display on the left
- image: 'img/gritter/buy.png',
- // (bool | optional) if you want it to fade out on its own or just sit there
- sticky: true,
- // (int | optional) the time you want it to be alive for before fading out
- time: '',
- // (string | optional) the class name you want to apply to that specific message
- class_name: 'my-sticky-class'
- });
- $.extend($.gritter.options, {
- position: 'top-right'
- });
- // You can have it return a unique id, this can be used to manually remove it later using
- setTimeout(function () {
- $.gritter.remove(unique_id, {
- fade: true,
- speed: 'slow'
- });
- }, 15000);
- }, 15000);
- setTimeout(function () {
- $.extend($.gritter.options, {
- position: 'top-left'
- });
- var unique_id = $.gritter.add({
- // (string | mandatory) the heading of the notification
- title: 'Notification',
- // (string | mandatory) the text inside the notification
- text: 'You have 6 new notifications.',
- // (bool | optional) if you want it to fade out on its own or just sit there
- sticky: true,
- // (int | optional) the time you want it to be alive for before fading out
- time: '',
- // (string | optional) the class name you want to apply to that specific message
- class_name: 'my-sticky-class'
- });
- setTimeout(function () {
- $.gritter.remove(unique_id, {
- fade: true,
- speed: 'slow'
- });
- }, 4000);
- $.extend($.gritter.options, {
- position: 'top-right'
- });
- }, 20000);
- setTimeout(function () {
- $.extend($.gritter.options, {
- position: 'top-left'
- });
- var unique_id = $.gritter.add({
- // (string | mandatory) the heading of the notification
- title: 'Inbox',
- // (string | mandatory) the text inside the notification
- text: 'You have 5 new messages in your inbox.',
- // (bool | optional) if you want it to fade out on its own or just sit there
- sticky: true,
- // (int | optional) the time you want it to be alive for before fading out
- time: '',
- // (string | optional) the class name you want to apply to that specific message
- class_name: 'my-sticky-class'
- });
- $.extend($.gritter.options, {
- position: 'top-right'
- });
- setTimeout(function () {
- $.gritter.remove(unique_id, {
- fade: true,
- speed: 'slow'
- });
- }, 4000);
- }, 25000);
- }
- /*-----------------------------------------------------------------------------------*/
- /* Handles Profile Edit
- /*-----------------------------------------------------------------------------------*/
- var handleProfileEdit = function () {
- $(".datepicker").datepicker();
- }
- return {
- //Initialise theme pages
- init: function () {
-
- if (App.isPage("index")) {
- handleDataTables();
- }
- if (App.isPage("slider")) {
- handleUploadSlider();
- }
- if (App.isPage("pdf")) {
- handleUploadPdf();
- }
- if (App.isPage("indexAdd")) {
- handleUploadLogo();
- }
- if (App.isPage("example")) {
- handleExampleTables();
- }
- if (App.isPage("news")) {
- handleNewsTables();
- }
- if(App.isPage('adminUserEdit')){
- handleUploadAvatar();
- }
- if(App.isPage('adminUserModifyPassView')){
- handleUserModifyPass();
- }
- if(App.isPage('cunstomListView')){
- handleDataTables();
- }
- if(App.isPage('orderListView')){
- handleOrderTables();
- }
- if(App.isPage('productionAdd')){
- handleUploadAvatar();
- }
-
- //leefouce
- if (App.isPage("login_bg")) {
- handleUniform(); //Function to handle uniform inputs
- handleBackstretch(); //Function to handle background images
- handleBootbox();//Function to Bootbox
- handleLogin();// Function to login
- }
- checkLayout(); //Function to check if mini menu/fixed header is activated
- handleSidebar(); //Function to display the sidebar
- handleSidebarCollapse(); //Function to hide or show sidebar
- handleSidebarAndContentHeight(); //Function to hide sidebar and main content height
- responsiveSidebar(); //Function to handle sidebar responsively
- },
- //Set page
- setPage: function (name) {
- currentPage = name;
- },
- isPage: function (name) {
- return currentPage == name ? true : false;
- },
- //public function to add callback a function which will be called on window resize
- addResponsiveFunction: function (func) {
- responsiveFunctions.push(func);
- },
- // wrapper function to scroll(focus) to an element
- scrollTo: function (el, offeset) {
- pos = (el && el.size() > 0) ? el.offset().top : 0;
- jQuery('html,body').animate({
- scrollTop: pos + (offeset ? offeset : 0)
- }, 'slow');
- },
- // function to scroll to the top
- scrollTop: function () {
- App.scrollTo();
- },
- // initializes uniform elements
- initUniform: function (els) {
- if (els) {
- jQuery(els).each(function () {
- if ($(this).parents(".checker").size() == 0) {
- $(this).show();
- $(this).uniform();
- }
- });
- } else {
- handleAllUniform();
- }
- },
- // wrapper function to block element(indicate loading)
- blockUI: function (el, loaderOnTop) {
- lastBlockedUI = el;
- jQuery(el).block({
- message: '<img src="./img/loaders/12.gif" align="absmiddle">',
- css: {
- border: 'none',
- padding: '2px',
- backgroundColor: 'none'
- },
- overlayCSS: {
- backgroundColor: '#000',
- opacity: 0.05,
- cursor: 'wait'
- }
- });
- },
- // wrapper function to un-block element(finish loading)
- unblockUI: function (el) {
- jQuery(el).unblock({
- onUnblock: function () {
- jQuery(el).removeAttr("style");
- }
- });
- },
- };
- }();
- (function (a, b) {
- a.fn.admin_tree = function (d) {
- var c = {
- "open-icon": "fa fa-folder-open",
- "close-icon": "fa fa-folder",
- selectable: true,
- "selected-icon": "fa fa-check",
- "unselected-icon": "tree-dot"
- };
- c = a.extend({}, c, d);
- this.each(function () {
- var e = a(this);
- e.html('<div class = "tree-folder" style="display:none;"> <div class="tree-folder-header"> <i class="' + c["close-icon"] + '"></i> <div class="tree-folder-name"></div> </div> <div class="tree-folder-content"></div> <div class="tree-loader" style="display:none"></div> </div> <div class="tree-item" style="display:none;"> ' + (c["unselected-icon"] == null ? "" : '<i class="' + c["unselected-icon"] + '"></i>') + ' <div class="tree-item-name"></div> </div>');
- e.addClass(c.selectable == true ? "tree-selectable" : "tree-unselectable");
- e.tree(c)
- });
- return this
- }
- })(window.jQuery);
- (function () {
- this.Theme = (function () {
- function Theme() {}
- Theme.colors = {
- white: "#FFFFFF",
- primary: "#5E87B0",
- red: "#D9534F",
- green: "#A8BC7B",
- blue: "#70AFC4",
- orange: "#F0AD4E",
- yellow: "#FCD76A",
- gray: "#6B787F",
- lightBlue: "#D4E5DE",
- purple: "#A696CE",
- pink: "#DB5E8C",
- dark_orange: "#F38630"
- };
- return Theme;
- })();
- })(window.jQuery);
|