'use strict';
if(typeof window.CBXWPBOOKMARK_FILTERS==='undefined'){
window.CBXWPBOOKMARK_FILTERS={};
window.CBXWPBOOKMARK_ACTIONS={};
window._CBXWPBookmarkEvents_add=function (type, tag, function_to_add, priority){
var lists=('filter'===type) ? CBXWPBOOKMARK_FILTERS:CBXWPBOOKMARK_ACTIONS;
priority=(priority||10);
if(!(tag in lists)){
lists[tag]=[];
}
if(!(priority in lists[tag])){
lists[tag][priority]=[];
}
lists[tag][priority].push({
func: function_to_add,
pri:priority
});
};
window.CBXWPBookmarkEvents_add_filter=function (tag, function_to_add, priority){
_CBXWPBookmarkEvents_add('filter', tag, function_to_add, priority);
};
window.CBXWPBookmarkEvents_add_action=function (tag, function_to_add, priority){
_CBXWPBookmarkEvents_add('action', tag, function_to_add, priority);
};
window.CBXWPBookmarkEvents_do=function (type, args){
var hook, lists=('action'===type) ? CBXWPBOOKMARK_ACTIONS:CBXWPBOOKMARK_FILTERS;
var tag=args[0];
if(!(tag in lists)){
return args[1];
}
[].shift.apply(args);
for (var pri in lists[tag]){
hook=lists[tag][pri];
if(typeof hook!=='undefined'){
for (var f in hook){
var func=hook[f].func;
if(typeof func==="function"){
if('filter'===type){
args[0]=func.apply(null, args);
}else{
func.apply(null, args);
}}else{
}}
}}
if('filter'===type){
return args[0];
}};
window.CBXWPBookmarkEvents_apply_filters=function (tag, value, varargs){
return CBXWPBookmarkEvents_do('filter', arguments);
};
window.CBXWPBookmarkEvents_do_action=function (tag, args){
CBXWPBookmarkEvents_do('action', arguments);
};};