MCPcopy Create free account
hub / github.com/blockstrap/framework / plugin

Function plugin

blockstrap/js/blockstrap.js:2100–2374  ·  view source on GitHub ↗
(element, options, defaults, store, force_skip)

Source from the content-addressed store, hash-verified

2098
2099 // PLUGIN CONSTRUCTOR
2100 function plugin(element, options, defaults, store, force_skip)
2101 {
2102 if(!is_loaded)
2103 {
2104 is_loaded = true;
2105 // ACCOUNT FOR ORIGINAL SETTINGS IF THIS IS LOADED MANUALLY FOR SECOND TIME
2106 var old_settngs = {};
2107 if(typeof $.fn.blockstrap.settings != 'undefined')
2108 {
2109 old_settings = $.fn.blockstrap.settings;
2110 }
2111
2112 // MERGE DEFAULT AND PLUGIN OPTIONS
2113 var settings = $.extend(old_settings, defaults, options);
2114
2115 var skip = false;
2116 if(settings.skip_config) skip = true;
2117 if(force_skip === true) skip = true
2118
2119 if(typeof $.fn.blockstrap.settings.install === 'undefined')
2120 {
2121 $.fn.blockstrap.settings.install = true;
2122 }
2123
2124 // THEN GET CONFIG FILE
2125 $.fn.blockstrap.core.get('themes/config', 'json', function(results)
2126 {
2127 if($.isPlainObject(results))
2128 {
2129 $.fn.blockstrap.settings = $.extend({}, settings, results);
2130
2131 // MERGE WITH HTML ATTRBUTE OPTIONS
2132 $.fn.blockstrap.core.settings(element);
2133
2134 if($.fn.blockstrap.settings.skip_config) skip = true;
2135
2136 // NOW NEED TO GET THEME SPECIFIC OPTIONS AND MERGE WITH THESE
2137 var current_theme = $.fn.blockstrap.settings.theme;
2138 $.fn.blockstrap.core.get('themes/'+current_theme+'/config', 'json', function(results)
2139 {
2140 if($.isPlainObject(results))
2141 {
2142
2143 var set = $.extend(
2144 {},
2145 $.fn.blockstrap.settings,
2146 results
2147 );
2148
2149 $.fn.blockstrap.settings = set;
2150
2151 $.fn.blockstrap.defaults();
2152
2153 // ONE LAST SECRET CONFIG THAT CAN OVER-RIDE EVERTYHING AND IS NOT STORED IN REPO
2154 // THE EXACT LOCATION OF THIS FILE CAN ULTIMATELY BE DEFINED BY PREVIOUS CONFIG FILES
2155 var secret_config = 'secret';
2156 $.fn.blockstrap.core.get(secret_config, 'json', function(results)
2157 {

Callers 2

blockstrap_coreFunction · 0.85
_fnFeatureHtmlPaginateFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected