diff --git a/classes/lnApp/Block.php b/classes/lnApp/Block.php index 6ae2e78..2f3e29e 100644 --- a/classes/lnApp/Block.php +++ b/classes/lnApp/Block.php @@ -50,11 +50,11 @@ abstract class lnApp_Block extends HTMLRender { $record = self::$_data[$this->_x]; $output = ''; - $output .= sprintf('
',empty($record['span']) ? '12' : $record['span'],empty($record['scrollable']) ? '' : 'scrollable'); + $output .= sprintf('
',empty($record['span']) ? '12' : $record['span'],empty($record['scrollable']) ? '' : 'scrollable'); $output .= '
'; if (! empty($record['title'])) - $output .= sprintf('
%s

%s

',empty($record['title_icon']) ? '' : sprintf(' ',$record['title_icon']),$record['title']); + $output .= sprintf('
%s

%s

',empty($record['title_icon']) ? '' : sprintf(' ',$record['title_icon']),$record['title']); $output .= '
'; @@ -65,7 +65,7 @@ abstract class lnApp_Block extends HTMLRender { $output .= Form::close(); break; - case 'form-horizontal': $output .= Form::open(NULL,Arr::merge(array('class'=>'form-horizontal'),(empty($record['id']) ? array() : array('id'=>$record['id'])))); + case 'form-horizontal': $output .= Form::open(NULL,Arr::merge(array('class'=>'form-horizontal','role'=>'form'),(empty($record['id']) ? array() : array('id'=>$record['id'])))); $output .= (string)$record['body']; $output .= Form::close(); break; @@ -79,7 +79,7 @@ abstract class lnApp_Block extends HTMLRender { $output .= '
'; $output .= '
'; - $output .= '
'; + $output .= '
'; return $output; } diff --git a/classes/lnApp/Controller/Login.php b/classes/lnApp/Controller/Login.php index bb5342f..4991276 100644 --- a/classes/lnApp/Controller/Login.php +++ b/classes/lnApp/Controller/Login.php @@ -16,6 +16,9 @@ class lnApp_Controller_Login extends Controller_TemplateDefault { public function action_index() { $output = ''; + if (! array_key_exists('auth',Kohana::modules())) + throw HTTP_Exception::factory(501,'Auth not enabled.'); + // If user already signed-in if (Auth::instance()->logged_in()) HTTP::redirect(URL::link('user','welcome/index')); @@ -35,7 +38,7 @@ class lnApp_Controller_Login extends Controller_TemplateDefault { } else { SystemMessage::factory() ->title(_('Invalid username or password')) - ->type('error') + ->type('danger') ->body(_('The username or password was invalid.')); } } @@ -48,10 +51,6 @@ class lnApp_Controller_Login extends Controller_TemplateDefault { $output .= View::factory('pages/login') ->set('oauth',$oauthlogin); - Style::factory() - ->type('file') - ->data('media/theme/baseadmin/css/pages/login.css'); - Style::factory() ->type('file') ->data('media/css/auth-buttons.css'); @@ -67,7 +66,7 @@ class lnApp_Controller_Login extends Controller_TemplateDefault { public function action_noaccess() { SystemMessage::factory() ->title(_('No access to requested resource')) - ->type('error') + ->type('danger') ->body(_('You do not have access to the requested resource, please contact your administrator.')); } } diff --git a/classes/lnApp/Controller/TemplateDefault.php b/classes/lnApp/Controller/TemplateDefault.php index 0c78c40..046235e 100644 --- a/classes/lnApp/Controller/TemplateDefault.php +++ b/classes/lnApp/Controller/TemplateDefault.php @@ -105,7 +105,7 @@ abstract class lnApp_Controller_TemplateDefault extends Kohana_Controller_Templa if ($this->request->is_ajax()) throw HTTP_Exception::factory(403,_('You dont have enough permissions.')); else - if (! Kohana::$config->load('debug')->disabled_noaccess_redirect) + if (! Kohana::$config->load('config')->disabled_noaccess_redirect) HTTP::redirect('login/noaccess'); else throw HTTP_Exception::factory(501,'I would redirect you here - no ACCESS'); diff --git a/classes/lnApp/Form.php b/classes/lnApp/Form.php index a03fa93..6f73403 100644 --- a/classes/lnApp/Form.php +++ b/classes/lnApp/Form.php @@ -16,6 +16,7 @@ abstract class lnApp_Form extends Kohana_Form { * @return array((string) control group wrapper,(array) attributes to exclude */ private static function _controlgroup($name,array &$attributes=NULL) { + // Bypass this rendering if nocg is set. if (isset($attributes['nocg'])) { unset($attributes['nocg']); return '%s'; @@ -23,10 +24,11 @@ abstract class lnApp_Form extends Kohana_Form { $output = ''; - $output .= '
'; + $output .= '
'; + // Only need col-md for horizonal forms? if (isset($attributes['label'])) { - $output .= Form::label($name,$attributes['label'],array('class'=>'control-label')); + $output .= Form::label($name,$attributes['label'],array('class'=>'col-md-2 control-label')); unset($attributes['label']); } @@ -40,17 +42,25 @@ abstract class lnApp_Form extends Kohana_Form { unset($attributes['add-on']); } - $output .= '
'; + $classdiv = FALSE; + if (isset($attributes['class'])) { + $output .= sprintf('
',$attributes['class']); + unset($attributes['class']); + $classdiv = TRUE; + } + $output .= '%s'; + if ($classdiv) + $output .= '
'; + if (isset($help)) $output .= sprintf('%s',$help); if (isset($addon)) - $output .= sprintf('%s',$addon); + $output .= sprintf('%s',$addon); $output .= '
'; - $output .= '
'; return $output; } @@ -71,7 +81,7 @@ abstract class lnApp_Form extends Kohana_Form { * @usedby Form::image */ public static function input($name,$value=NULL,array $attributes=NULL) { - return (isset($attributes['type']) AND $attributes['type'] == 'hidden') ? parent::input($name,$value,$attributes) : sprintf(self::_controlgroup($name,$attributes),parent::input($name,$value,$attributes)); + return (isset($attributes['type']) AND $attributes['type'] == 'hidden') ? parent::input($name,$value,$attributes) : sprintf(self::_controlgroup($name,$attributes),parent::input($name,$value,Arr::merge($attributes,array('class'=>'form-control')))); } public static function select($name,array $options=NULL,$selected=NULL,array $attributes=NULL) { diff --git a/classes/lnApp/HTTP/Exception.php b/classes/lnApp/HTTP/Exception.php index e00b217..5ceff50 100644 --- a/classes/lnApp/HTTP/Exception.php +++ b/classes/lnApp/HTTP/Exception.php @@ -20,7 +20,7 @@ abstract class lnApp_HTTP_Exception extends Kohana_HTTP_Exception { ->set('message',$this->getMessage()); $output .= '
'; - $output .= HTML::anchor((URL::admin_url() ? 'u/' : '').'welcome',' Back to Home',array('class'=>'btn btn-large btn-primary')); + $output .= HTML::anchor((array_key_exists('auth',Kohana::modules()) AND URL::admin_url() ? 'u/' : '').'welcome',' Back to Home',array('class'=>'btn btn-large btn-primary')); $output .= '
'; $output .= '
'; diff --git a/classes/lnApp/StaticList/YesNo.php b/classes/lnApp/StaticList/YesNo.php index fc09dd5..4c21811 100644 --- a/classes/lnApp/StaticList/YesNo.php +++ b/classes/lnApp/StaticList/YesNo.php @@ -22,7 +22,7 @@ abstract class lnApp_StaticList_YesNo extends StaticList { $value = 0; return $format ? View::factory(Site::Theme().'/label/bool') - ->set('label',$value ? 'label-success' : '') + ->set('label',$value ? 'label-success' : 'label-default') ->set('column',StaticList_YesNo::factory()->_get($value)) : $value; } } diff --git a/classes/lnApp/URL.php b/classes/lnApp/URL.php index 5229c40..0909b94 100644 --- a/classes/lnApp/URL.php +++ b/classes/lnApp/URL.php @@ -59,13 +59,13 @@ abstract class lnApp_URL extends Kohana_URL { foreach (array_reverse(self::$method_directory) as $k=>$v) switch ($k) { - case 'admin': $result[$k] = array('name'=>'Administrator','icon'=>'icon-globe'); + case 'admin': $result[$k] = array('name'=>'Administrator','icon'=>'fa-globe'); break; - case 'user': $result[$k] = array('name'=>class_exists('Auth') ? Auth::instance()->get_user()->name() : 'Guest','icon'=>'icon-user'); + case 'user': $result[$k] = array('name'=>array_key_exists('auth',Kohana::modules()) ? Auth::instance()->get_user()->name() : 'Guest','icon'=>'fa-user'); break; - default: $result[$k] = array('name'=>$k,'icon'=>'icon-question-sign'); + default: $result[$k] = array('name'=>$k,'icon'=>'fa-question-sign'); } return $result; diff --git a/config/config.php b/config/config.php index 2f77d5a..ad6a80a 100644 --- a/config/config.php +++ b/config/config.php @@ -12,6 +12,7 @@ return array( 'id' => '', // Site ID, for mullti site usage + 'disabled_noaccess_redirect' => FALSE, // Whether to redirect on no access, or show an error 'date_format' => 'd-M-Y', // Site Date Format 'language' => 'auto', // Site Language 'method_security' => FALSE, // Enable User Based method security diff --git a/media/js/typeahead.bundle.min.js b/media/js/typeahead.bundle.min.js new file mode 100644 index 0000000..11dcbf4 --- /dev/null +++ b/media/js/typeahead.bundle.min.js @@ -0,0 +1,7 @@ +/*! + * typeahead.js 0.10.5 + * https://github.com/twitter/typeahead.js + * Copyright 2013-2014 Twitter, Inc. and other contributors; Licensed MIT + */ + +!function(a){var b=function(){"use strict";return{isMsie:function(){return/(msie|trident)/i.test(navigator.userAgent)?navigator.userAgent.match(/(msie |rv:)(\d+(.\d+)?)/i)[2]:!1},isBlankString:function(a){return!a||/^\s*$/.test(a)},escapeRegExChars:function(a){return a.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")},isString:function(a){return"string"==typeof a},isNumber:function(a){return"number"==typeof a},isArray:a.isArray,isFunction:a.isFunction,isObject:a.isPlainObject,isUndefined:function(a){return"undefined"==typeof a},toStr:function(a){return b.isUndefined(a)||null===a?"":a+""},bind:a.proxy,each:function(b,c){function d(a,b){return c(b,a)}a.each(b,d)},map:a.map,filter:a.grep,every:function(b,c){var d=!0;return b?(a.each(b,function(a,e){return(d=c.call(null,e,a,b))?void 0:!1}),!!d):d},some:function(b,c){var d=!1;return b?(a.each(b,function(a,e){return(d=c.call(null,e,a,b))?!1:void 0}),!!d):d},mixin:a.extend,getUniqueId:function(){var a=0;return function(){return a++}}(),templatify:function(b){function c(){return String(b)}return a.isFunction(b)?b:c},defer:function(a){setTimeout(a,0)},debounce:function(a,b,c){var d,e;return function(){var f,g,h=this,i=arguments;return f=function(){d=null,c||(e=a.apply(h,i))},g=c&&!d,clearTimeout(d),d=setTimeout(f,b),g&&(e=a.apply(h,i)),e}},throttle:function(a,b){var c,d,e,f,g,h;return g=0,h=function(){g=new Date,e=null,f=a.apply(c,d)},function(){var i=new Date,j=b-(i-g);return c=this,d=arguments,0>=j?(clearTimeout(e),e=null,g=i,f=a.apply(c,d)):e||(e=setTimeout(h,j)),f}},noop:function(){}}}(),c="0.10.5",d=function(){"use strict";function a(a){return a=b.toStr(a),a?a.split(/\s+/):[]}function c(a){return a=b.toStr(a),a?a.split(/\W+/):[]}function d(a){return function(){var c=[].slice.call(arguments,0);return function(d){var e=[];return b.each(c,function(c){e=e.concat(a(b.toStr(d[c])))}),e}}}return{nonword:c,whitespace:a,obj:{nonword:d(c),whitespace:d(a)}}}(),e=function(){"use strict";function c(c){this.maxSize=b.isNumber(c)?c:100,this.reset(),this.maxSize<=0&&(this.set=this.get=a.noop)}function d(){this.head=this.tail=null}function e(a,b){this.key=a,this.val=b,this.prev=this.next=null}return b.mixin(c.prototype,{set:function(a,b){var c,d=this.list.tail;this.size>=this.maxSize&&(this.list.remove(d),delete this.hash[d.key]),(c=this.hash[a])?(c.val=b,this.list.moveToFront(c)):(c=new e(a,b),this.list.add(c),this.hash[a]=c,this.size++)},get:function(a){var b=this.hash[a];return b?(this.list.moveToFront(b),b.val):void 0},reset:function(){this.size=0,this.hash={},this.list=new d}}),b.mixin(d.prototype,{add:function(a){this.head&&(a.next=this.head,this.head.prev=a),this.head=a,this.tail=this.tail||a},remove:function(a){a.prev?a.prev.next=a.next:this.head=a.next,a.next?a.next.prev=a.prev:this.tail=a.prev},moveToFront:function(a){this.remove(a),this.add(a)}}),c}(),f=function(){"use strict";function a(a){this.prefix=["__",a,"__"].join(""),this.ttlKey="__ttl__",this.keyMatcher=new RegExp("^"+b.escapeRegExChars(this.prefix))}function c(){return(new Date).getTime()}function d(a){return JSON.stringify(b.isUndefined(a)?null:a)}function e(a){return JSON.parse(a)}var f,g;try{f=window.localStorage,f.setItem("~~~","!"),f.removeItem("~~~")}catch(h){f=null}return g=f&&window.JSON?{_prefix:function(a){return this.prefix+a},_ttlKey:function(a){return this._prefix(a)+this.ttlKey},get:function(a){return this.isExpired(a)&&this.remove(a),e(f.getItem(this._prefix(a)))},set:function(a,e,g){return b.isNumber(g)?f.setItem(this._ttlKey(a),d(c()+g)):f.removeItem(this._ttlKey(a)),f.setItem(this._prefix(a),d(e))},remove:function(a){return f.removeItem(this._ttlKey(a)),f.removeItem(this._prefix(a)),this},clear:function(){var a,b,c=[],d=f.length;for(a=0;d>a;a++)(b=f.key(a)).match(this.keyMatcher)&&c.push(b.replace(this.keyMatcher,""));for(a=c.length;a--;)this.remove(c[a]);return this},isExpired:function(a){var d=e(f.getItem(this._ttlKey(a)));return b.isNumber(d)&&c()>d?!0:!1}}:{get:b.noop,set:b.noop,remove:b.noop,clear:b.noop,isExpired:b.noop},b.mixin(a.prototype,g),a}(),g=function(){"use strict";function c(b){b=b||{},this.cancelled=!1,this.lastUrl=null,this._send=b.transport?d(b.transport):a.ajax,this._get=b.rateLimiter?b.rateLimiter(this._get):this._get,this._cache=b.cache===!1?new e(0):i}function d(c){return function(d,e){function f(a){b.defer(function(){h.resolve(a)})}function g(a){b.defer(function(){h.reject(a)})}var h=a.Deferred();return c(d,e,f,g),h}}var f=0,g={},h=6,i=new e(10);return c.setMaxPendingRequests=function(a){h=a},c.resetCache=function(){i.reset()},b.mixin(c.prototype,{_get:function(a,b,c){function d(b){c&&c(null,b),k._cache.set(a,b)}function e(){c&&c(!0)}function i(){f--,delete g[a],k.onDeckRequestArgs&&(k._get.apply(k,k.onDeckRequestArgs),k.onDeckRequestArgs=null)}var j,k=this;this.cancelled||a!==this.lastUrl||((j=g[a])?j.done(d).fail(e):h>f?(f++,g[a]=this._send(a,b).done(d).fail(e).always(i)):this.onDeckRequestArgs=[].slice.call(arguments,0))},get:function(a,c,d){var e;return b.isFunction(c)&&(d=c,c={}),this.cancelled=!1,this.lastUrl=a,(e=this._cache.get(a))?b.defer(function(){d&&d(null,e)}):this._get(a,c,d),!!e},cancel:function(){this.cancelled=!0}}),c}(),h=function(){"use strict";function c(b){b=b||{},b.datumTokenizer&&b.queryTokenizer||a.error("datumTokenizer and queryTokenizer are both required"),this.datumTokenizer=b.datumTokenizer,this.queryTokenizer=b.queryTokenizer,this.reset()}function d(a){return a=b.filter(a,function(a){return!!a}),a=b.map(a,function(a){return a.toLowerCase()})}function e(){return{ids:[],children:{}}}function f(a){for(var b={},c=[],d=0,e=a.length;e>d;d++)b[a[d]]||(b[a[d]]=!0,c.push(a[d]));return c}function g(a,b){function c(a,b){return a-b}var d=0,e=0,f=[];a=a.sort(c),b=b.sort(c);for(var g=a.length,h=b.length;g>d&&h>e;)a[d]b[e]?e++:(f.push(a[d]),d++,e++);return f}return b.mixin(c.prototype,{bootstrap:function(a){this.datums=a.datums,this.trie=a.trie},add:function(a){var c=this;a=b.isArray(a)?a:[a],b.each(a,function(a){var f,g;f=c.datums.push(a)-1,g=d(c.datumTokenizer(a)),b.each(g,function(a){var b,d,g;for(b=c.trie,d=a.split("");g=d.shift();)b=b.children[g]||(b.children[g]=e()),b.ids.push(f)})})},get:function(a){var c,e,h=this;return c=d(this.queryTokenizer(a)),b.each(c,function(a){var b,c,d,f;if(e&&0===e.length)return!1;for(b=h.trie,c=a.split("");b&&(d=c.shift());)b=b.children[d];return b&&0===c.length?(f=b.ids.slice(0),void(e=e?g(e,f):f)):(e=[],!1)}),e?b.map(f(e),function(a){return h.datums[a]}):[]},reset:function(){this.datums=[],this.trie=e()},serialize:function(){return{datums:this.datums,trie:this.trie}}}),c}(),i=function(){"use strict";function d(a){return a.local||null}function e(d){var e,f;return f={url:null,thumbprint:"",ttl:864e5,filter:null,ajax:{}},(e=d.prefetch||null)&&(e=b.isString(e)?{url:e}:e,e=b.mixin(f,e),e.thumbprint=c+e.thumbprint,e.ajax.type=e.ajax.type||"GET",e.ajax.dataType=e.ajax.dataType||"json",!e.url&&a.error("prefetch requires url to be set")),e}function f(c){function d(a){return function(c){return b.debounce(c,a)}}function e(a){return function(c){return b.throttle(c,a)}}var f,g;return g={url:null,cache:!0,wildcard:"%QUERY",replace:null,rateLimitBy:"debounce",rateLimitWait:300,send:null,filter:null,ajax:{}},(f=c.remote||null)&&(f=b.isString(f)?{url:f}:f,f=b.mixin(g,f),f.rateLimiter=/^throttle$/i.test(f.rateLimitBy)?e(f.rateLimitWait):d(f.rateLimitWait),f.ajax.type=f.ajax.type||"GET",f.ajax.dataType=f.ajax.dataType||"json",delete f.rateLimitBy,delete f.rateLimitWait,!f.url&&a.error("remote requires url to be set")),f}return{local:d,prefetch:e,remote:f}}();!function(c){"use strict";function e(b){b&&(b.local||b.prefetch||b.remote)||a.error("one of local, prefetch, or remote is required"),this.limit=b.limit||5,this.sorter=j(b.sorter),this.dupDetector=b.dupDetector||k,this.local=i.local(b),this.prefetch=i.prefetch(b),this.remote=i.remote(b),this.cacheKey=this.prefetch?this.prefetch.cacheKey||this.prefetch.url:null,this.index=new h({datumTokenizer:b.datumTokenizer,queryTokenizer:b.queryTokenizer}),this.storage=this.cacheKey?new f(this.cacheKey):null}function j(a){function c(b){return b.sort(a)}function d(a){return a}return b.isFunction(a)?c:d}function k(){return!1}var l,m;return l=c.Bloodhound,m={data:"data",protocol:"protocol",thumbprint:"thumbprint"},c.Bloodhound=e,e.noConflict=function(){return c.Bloodhound=l,e},e.tokenizers=d,b.mixin(e.prototype,{_loadPrefetch:function(b){function c(a){f.clear(),f.add(b.filter?b.filter(a):a),f._saveToStorage(f.index.serialize(),b.thumbprint,b.ttl)}var d,e,f=this;return(d=this._readFromStorage(b.thumbprint))?(this.index.bootstrap(d),e=a.Deferred().resolve()):e=a.ajax(b.url,b.ajax).done(c),e},_getFromRemote:function(a,b){function c(a,c){b(a?[]:f.remote.filter?f.remote.filter(c):c)}var d,e,f=this;if(this.transport)return a=a||"",e=encodeURIComponent(a),d=this.remote.replace?this.remote.replace(this.remote.url,a):this.remote.url.replace(this.remote.wildcard,e),this.transport.get(d,this.remote.ajax,c)},_cancelLastRemoteRequest:function(){this.transport&&this.transport.cancel()},_saveToStorage:function(a,b,c){this.storage&&(this.storage.set(m.data,a,c),this.storage.set(m.protocol,location.protocol,c),this.storage.set(m.thumbprint,b,c))},_readFromStorage:function(a){var b,c={};return this.storage&&(c.data=this.storage.get(m.data),c.protocol=this.storage.get(m.protocol),c.thumbprint=this.storage.get(m.thumbprint)),b=c.thumbprint!==a||c.protocol!==location.protocol,c.data&&!b?c.data:null},_initialize:function(){function c(){e.add(b.isFunction(f)?f():f)}var d,e=this,f=this.local;return d=this.prefetch?this._loadPrefetch(this.prefetch):a.Deferred().resolve(),f&&d.done(c),this.transport=this.remote?new g(this.remote):null,this.initPromise=d.promise()},initialize:function(a){return!this.initPromise||a?this._initialize():this.initPromise},add:function(a){this.index.add(a)},get:function(a,c){function d(a){var d=f.slice(0);b.each(a,function(a){var c;return c=b.some(d,function(b){return e.dupDetector(a,b)}),!c&&d.push(a),d.length0||!this.transport)&&c&&c(f)},clear:function(){this.index.reset()},clearPrefetchCache:function(){this.storage&&this.storage.clear()},clearRemoteCache:function(){this.transport&&g.resetCache()},ttAdapter:function(){return b.bind(this.get,this)}}),e}(this);var j=function(){return{wrapper:'',dropdown:'',dataset:'
',suggestions:'',suggestion:'
'}}(),k=function(){"use strict";var a={wrapper:{position:"relative",display:"inline-block"},hint:{position:"absolute",top:"0",left:"0",borderColor:"transparent",boxShadow:"none",opacity:"1"},input:{position:"relative",verticalAlign:"top",backgroundColor:"transparent"},inputWithNoHint:{position:"relative",verticalAlign:"top"},dropdown:{position:"absolute",top:"100%",left:"0",zIndex:"100",display:"none"},suggestions:{display:"block"},suggestion:{whiteSpace:"nowrap",cursor:"pointer"},suggestionChild:{whiteSpace:"normal"},ltr:{left:"0",right:"auto"},rtl:{left:"auto",right:" 0"}};return b.isMsie()&&b.mixin(a.input,{backgroundImage:"url(data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)"}),b.isMsie()&&b.isMsie()<=7&&b.mixin(a.input,{marginTop:"-1px"}),a}(),l=function(){"use strict";function c(b){b&&b.el||a.error("EventBus initialized without el"),this.$el=a(b.el)}var d="typeahead:";return b.mixin(c.prototype,{trigger:function(a){var b=[].slice.call(arguments,1);this.$el.trigger(d+a,b)}}),c}(),m=function(){"use strict";function a(a,b,c,d){var e;if(!c)return this;for(b=b.split(i),c=d?h(c,d):c,this._callbacks=this._callbacks||{};e=b.shift();)this._callbacks[e]=this._callbacks[e]||{sync:[],async:[]},this._callbacks[e][a].push(c);return this}function b(b,c,d){return a.call(this,"async",b,c,d)}function c(b,c,d){return a.call(this,"sync",b,c,d)}function d(a){var b;if(!this._callbacks)return this;for(a=a.split(i);b=a.shift();)delete this._callbacks[b];return this}function e(a){var b,c,d,e,g;if(!this._callbacks)return this;for(a=a.split(i),d=[].slice.call(arguments,1);(b=a.shift())&&(c=this._callbacks[b]);)e=f(c.sync,this,[b].concat(d)),g=f(c.async,this,[b].concat(d)),e()&&j(g);return this}function f(a,b,c){function d(){for(var d,e=0,f=a.length;!d&&f>e;e+=1)d=a[e].apply(b,c)===!1;return!d}return d}function g(){var a;return a=window.setImmediate?function(a){setImmediate(function(){a()})}:function(a){setTimeout(function(){a()},0)}}function h(a,b){return a.bind?a.bind(b):function(){a.apply(b,[].slice.call(arguments,0))}}var i=/\s+/,j=g();return{onSync:c,onAsync:b,off:d,trigger:e}}(),n=function(a){"use strict";function c(a,c,d){for(var e,f=[],g=0,h=a.length;h>g;g++)f.push(b.escapeRegExChars(a[g]));return e=d?"\\b("+f.join("|")+")\\b":"("+f.join("|")+")",c?new RegExp(e):new RegExp(e,"i")}var d={node:null,pattern:null,tagName:"strong",className:null,wordsOnly:!1,caseSensitive:!1};return function(e){function f(b){var c,d,f;return(c=h.exec(b.data))&&(f=a.createElement(e.tagName),e.className&&(f.className=e.className),d=b.splitText(c.index),d.splitText(c[0].length),f.appendChild(d.cloneNode(!0)),b.parentNode.replaceChild(f,d)),!!c}function g(a,b){for(var c,d=3,e=0;e