App.core.js COREThe heart and soul of SmartAdmin - Responsive WebApp

Debugging console.log

view the app.core.js debugger in realtime;assists in the detection and correction of errors

App API

Control options for the app API
UsageReturnsDescription
nullPushes selected classes from the bodytag to localstorage/database
-Remove classes from body&saves to localstorage/database
-Clears your localStorage effectively removing all settings and panel configs
-Indicator for Save Settings (mostly aesthetics)
-Push array to bodytag. See saving to databasefor more details
stringFetch class names from bodyand convert them to JSON string. See saving to databasefor more details
stringDetects webkit and chrome browsers
stringDetects whether device is desktop or mobile
-Saves app settings to localstorage
-Saves app settings to localstorage
stringSaves app settings to localstorage
boolSaves app settings to localstorage
-Saves app settings to localstorage
-Fires a series of events,see "Initialization shell" to your left,for more details.

Action buttons

Allows you to add action to any HTML element on 'mouseUp' event
Action TypeDescription
togglePush data-class to bodyelement
data-action="toggle" data-class="class-a class-b" data-target="#ID"
toggle-swapdata-action="toggle-swap" data-class="class-a class-b" data-target="#ID"
data-panel-*Push array to bodytag. See saving to databasefor more details
theme-updatedata-action="theme-update" data-theme="path_to_css/css.css"
app-resetdata-action="app-reset"
factory-resetdata-action="factory-reset"
app-printPrint page (similar to pressing CTRL/CMD + P) data-action="app-print"
app-fullscreenActivates broswer's fullscreen command (may not work in all browsers) data-action="app-fullscreen"
app-loadscript Load scripts on demand data-action="app-fullscreen" data-loadurl="script.js" data-loadfunction="functionName()"or you can also use initApp.loadScript("js/my_lovely_script.js", myFunction)
playsound Play sounds using data-action="playsound" data-soundpath="media/sound/" data-soundfile="filename" (no file extensions)

Config settings

Define preferred application behaviors or configuration options; can modify some functionality of the app
var myapp_config = {	root_: $('body'),	root_logo: $('.page-sidebar >.page-logo')	throttleDelay: 450,	filterDelay: 150,	thisDevice: null, 	isMobile: (/iphone|ipad|ipod|android|blackberry|mini|windows\sce|palm/i.test(navigator.userAgent.toLowerCase())), 	mobileMenuTrigger: null,	mobileResolutionTrigger: 992,	isWebkit: ((!!window.chrome && !!window.chrome.webstore) === true || Object.prototype.toString.call(window.HTMLElement).indexOf('Constructor') >0 === true),	isChrome: (/chrom(e|ium)/.test(navigator.userAgent.toLowerCase())),	isIE: ( (window.navigator.userAgent.indexOf('Trident/') ) >0 ===true ),debugState:true,rippleEffect:true,mythemeAnchor:'#mytheme',navAnchor:'#js-primary-nav',navHooks:'#js-primary-nav >ul.navigation'	navClosedSign:'ni ni-chevron-down',navOpenedSign:'ni ni-chevron-up',navAccordion:true,navInitalized:'js-nav-built',navFilterInput:$('#nav_filter_input'),navHorizontalWrapperId:'js-nav-menu-wrapper',navSpeed:500,navClosedSign:'fal fa-angle-down',navOpenedSign:'fal fa-angle-up',appDateHook:$('.js-get-date'),storeLocally:true,jsArray :[]};

Initilization shell

Showcasing app JS skeleton
var initApp =(function(app) {app.saveSettings =function () {... }	app.resetSettings =function () {... }	app.accessIndicator =function () {... }	app.pushSettings =function (DB_string) {... }	app.getSettings =function () {... }	app.detectBrowserType =function () {... }	app.addDeviceType =function() {... }	app.windowScrollEvents =function () {... }	app.checkNavigationOrientation =function() {... }	app.buildNavigation =function() {... }	app.mobileCheckActivation =function(){... }	app.toggleVisibility =function (id) {... }	app.domReadyMisc =function() {...	}	return app;})({});$(window).resize($.throttle(myapp_config.throttleDelay,function (e) {initApp.mobileCheckActivation();}));$(window).scroll($.throttle(myapp_config.throttleDelay,function (e) {...	}));$(window).on('scroll',initApp.windowScrollEvents);jQuery(document).ready(function() {initApp.addDeviceType();initApp.detectBrowserType();initApp.mobileCheckActivation();initApp.buildNavigation(myapp_config.navHooks);initApp.domReadyMisc();});