All Downloads are FREE. Search and download functionalities are using the official Maven repository.

META-INF.resources.bsf.js.bsf.js Maven / Gradle / Ivy

The newest version!
/*
 
 Copyright 2014-2019 Riccardo Massera (TheCoder4.Eu)
 BootsFaces JS
 author: TheCoder4.eu

 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
*/
var process=process||{env:{NODE_ENV:"development"}};BsF={ajax:{},onCompleteCallback:{},onErrorCallback:{},onSuccessCallback:{},blockBlockUI:!1};
BsF.ajax.onevent=function(a){if("begin"===a.status)$.blockUI&&null!=$.blockUI&&!BsF.blockBlockUI&&$.blockUI();else if("complete"===a.status){var b=a.source.id.replace(/[^a-zA-Z0-9]+/g,"_");(b=null!=a.responseText&&0<=a.responseText.indexOf("")?BsF.onErrorCallback[b]:BsF.onSuccessCallback[b])&&null!=b&&"undefined"!=typeof b&&b();$.blockUI&&null!=$.blockUI&&$.unblockUI()}"success"==a.status&&(b=a.source.id.replace(/[^a-zA-Z0-9]+/g,"_"),(b=BsF.onCompleteCallback[b])&&null!=b&&"undefined"!=
typeof b&&b());"error"==a.status&&(b=a.source.id.replace(/[^a-zA-Z0-9]+/g,"_"),(b=BsF.onErrorCallback[b])&&null!=b&&"undefined"!=typeof b&&b())};BsF.ajax.cb=function(a,b,c,d){BsF.ajax.callAjax(a,b,c,"@all",d,null)};
BsF.ajax.callAjax=function(a,b,c,d,e,f,h,n,p,k){if(null==a.id||""==a.id)a=a.parentNode;var l=a.id,m=l.replace(/[^a-zA-Z0-9]+/g,"_"),g={};n&&(g.params={BsFEvent:n});(c=BsF.ajax.resolveJQuery(c))&&null!=c&&(g.render=c);(d=BsF.ajax.resolveJQuery(d))&&null!=d&&(g.execute=d);g[l]=l;BsF.onCompleteCallback[m]=e&&null!=e?e:null;BsF.onErrorCallback[m]=f&&null!=f?f:null;BsF.onSuccessCallback[m]=h&&null!=h?h:null;g.onevent=BsF.ajax.onevent;p&&(g.delay=p);if(k)for(var q in k)c=k[q],"object"===typeof c&&("Array"!=
c.constructor.name||1[^<]+<\/span>/,'');return a=a.replace(/[^<]+<\/span>/,'')}}
function jq(a){return"#"+a.replace(/(:|\.|\[|\]|,)/g,"\\$1")}BsF.substringMatcher=function(a){return function(b,c){var d=[];substrRegex=new RegExp(b,"i");$.each(a,function(e,f){substrRegex.test(f)&&d.push(f)});c(d)}};BsF.addParametersToForm=function(a,b){var c=[];a.parametersAddedTemporarily=c;var d=0,e;for(e in b)if(b.hasOwnProperty(e)){var f=document.createElement("input");f.type="hidden";f.name=e;f.value=b[e];a.appendChild(f);c[d++]=f}};
BsF.submitForm=function(a,b){a=document.getElementById(a);BsF.addParametersToForm(a,b);a.onsubmit?(b=a.onsubmit(),("undefined"==typeof b||b)&&a.submit()):a.submit();BsF.removeTemporalParametersFromForm(a)};BsF.removeTemporalParametersFromForm=function(a){var b=a.parametersAddedTemporarily;if(null!==b)for(var c=0;c




© 2015 - 2024 Weber Informatics LLC | Privacy Policy