diff --git a/admin/js/common.js b/admin/js/common.js index c95c71f..b3745ab 100644 --- a/admin/js/common.js +++ b/admin/js/common.js @@ -368,8 +368,8 @@ var qTranslateX=function(pg) if(h.name.lastIndexOf('[]') < 0){ bfnm += h.name.substring(p); }else{ - var len = h.name.length-p-2; - if(len > 0) bfnm += h.name.substring(p,len); + var len = h.name.length-2; + if(len > p) bfnm += h.name.substring(p,len); sfnm = '[]'; } } diff --git a/admin/js/common.min.js b/admin/js/common.min.js index a987d5e..0af1dd3 100644 --- a/admin/js/common.min.js +++ b/admin/js/common.min.js @@ -1 +1 @@ -function qtranxj_get_cookie(e){for(var a=document.cookie.split(";"),n=0;n||\[:[a-z]{2}\]|\[:\])/gi;return e.xsplit(a)},qtranxj_split=function(e){var a=qtranxj_get_split_blocks(e);return qtranxj_split_blocks(a)},qtranxj_split_blocks=function(e){for(var a=new Object,n=0;n/gi,l=/\[:([a-z]{2})\]/gi,t=!1,n=0;n"!=i&&"[:]"!=i)if(t)a[t]+=i,t=!1;else for(var g in a)a[g]+=i;else t=!1;else t=o[1];else t=o[1]}return a},String.prototype.xsplit=function(e){if(3==="a~b".split(/(~)/).length)return this.split(e);e.global||(e=new RegExp(e.source,"g"+(e.ignoreCase?"i":"")));for(var a,n=0,t=[];null!=(a=e.exec(this));)t.push(this.slice(n,a.index)),a.length>1&&t.push(a[1]),n=e.lastIndex;return n2&&e.name.lastIndexOf("[]")==e.name.length-2&&(e.id+=++n)),a[e.id])return!0;var s=a[e.id]={};s.name=e.name,s.contentField=e,s.lang=qTranslateConfig.activeLanguage;var o=qtranxj_split(e.value);e.value=o[s.lang];var r,l,g=s.name.indexOf("[");if(0>g)r="qtranslate-fields["+s.name+"]";else if(r="qtranslate-fields["+s.name.substring(0,g)+"]",s.name.lastIndexOf("[]")<0)r+=s.name.substring(g);else{var d=s.name.length-g-2;d>0&&(r+=s.name.substring(g,d)),l="[]"}s.fields={};for(var c in o){var f=o[c],u=r+"["+c+"]";l&&(u+=l);var h=qtranxj_ce("input",{name:u,type:"hidden",className:"hidden",value:f});s.fields[c]=h,e.parentNode.insertBefore(h,e)}return i||(i="["),s.sepfield=qtranxj_ce("input",{name:r+"[qtranslate-separator]",type:"hidden",className:"hidden",value:i}),e.parentNode.insertBefore(s.sepfield,e),s.separator=i,e.className+=" qtranxs-translatable",s},this.addContentHookC=function(e,a){return addContentHook(e,a,"[")},this.addContentHookB=function(e,a){return addContentHook(e,a,"[")},this.addContentHookById=function(e,a,n){return addContentHook(this.ge(e),a,n)},this.addContentHookByIdName=function(e,a){var n;switch(e[0]){case"<":case"[":n=e.substring(0,1),e=e.substring(1)}return this.addContentHookById(e,a,n)},this.addContentHookByIdC=function(e,a){return this.addContentHookById(e,a,"[")},this.addContentHookByIdB=function(e,a){return this.addContentHookById(e,a,"[")},this.removeContentHook=function(e){if(!e)return!1;if(!e.id)return!1;if(!a[e.id])return!1;var n=a[e.id];n.sepfield&&jQuery(n.sepfield).remove();for(var t in n.fields)jQuery(n.fields[t]).remove();return jQuery(e).removeClass("qtranxs-translatable"),delete a[e.id],!0};var t=[];addDisplayHookNode=function(e){if(!e.nodeValue)return 0;var a=qtranxj_get_split_blocks(e.nodeValue);if(!a||!a.length||1==a.length)return 0;var n={};return n.nd=e,n.contents=qtranxj_split_blocks(a),e.nodeValue=n.contents[qTranslateConfig.activeLanguage],t.push(n),1};var i=[];if(addDisplayHookAttr=function(e){if(!e.value)return 0;var a=qtranxj_get_split_blocks(e.value);if(!a||!a.length||1==a.length)return 0;var n={};return n.nd=e,n.contents=qtranxj_split_blocks(a),e.value=n.contents[qTranslateConfig.activeLanguage],i.push(n),1},addDisplayHook=function(e){if(!e||!e.tagName)return 0;switch(e.tagName){case"TEXTAREA":return 0;case"INPUT":switch(e.type){case"submit":if(e.value)return addDisplayHookAttr(e);default:return 0}}var a=0;if(e.childNodes&&e.childNodes.length)for(var n=0;n1){var r=[];if(qTranslateConfig.page_config&&qTranslateConfig.page_config.anchors)for(var l=0;l||\[:[a-z]{2}\]|\[:\])/gi;return e.xsplit(a)},qtranxj_split=function(e){var a=qtranxj_get_split_blocks(e);return qtranxj_split_blocks(a)},qtranxj_split_blocks=function(e){for(var a=new Object,n=0;n/gi,l=/\[:([a-z]{2})\]/gi,t=!1,n=0;n"!=i&&"[:]"!=i)if(t)a[t]+=i,t=!1;else for(var g in a)a[g]+=i;else t=!1;else t=o[1];else t=o[1]}return a},String.prototype.xsplit=function(e){if(3==="a~b".split(/(~)/).length)return this.split(e);e.global||(e=new RegExp(e.source,"g"+(e.ignoreCase?"i":"")));for(var a,n=0,t=[];null!=(a=e.exec(this));)t.push(this.slice(n,a.index)),a.length>1&&t.push(a[1]),n=e.lastIndex;return n2&&e.name.lastIndexOf("[]")==e.name.length-2&&(e.id+=++n)),a[e.id])return!0;var s=a[e.id]={};s.name=e.name,s.contentField=e,s.lang=qTranslateConfig.activeLanguage;var o=qtranxj_split(e.value);e.value=o[s.lang];var r,l,g=s.name.indexOf("[");if(0>g)r="qtranslate-fields["+s.name+"]";else if(r="qtranslate-fields["+s.name.substring(0,g)+"]",s.name.lastIndexOf("[]")<0)r+=s.name.substring(g);else{var d=s.name.length-2;d>g&&(r+=s.name.substring(g,d)),l="[]"}s.fields={};for(var c in o){var f=o[c],u=r+"["+c+"]";l&&(u+=l);var h=qtranxj_ce("input",{name:u,type:"hidden",className:"hidden",value:f});s.fields[c]=h,e.parentNode.insertBefore(h,e)}return i||(i="["),s.sepfield=qtranxj_ce("input",{name:r+"[qtranslate-separator]",type:"hidden",className:"hidden",value:i}),e.parentNode.insertBefore(s.sepfield,e),s.separator=i,e.className+=" qtranxs-translatable",s},this.addContentHookC=function(e,a){return addContentHook(e,a,"[")},this.addContentHookB=function(e,a){return addContentHook(e,a,"[")},this.addContentHookById=function(e,a,n){return addContentHook(this.ge(e),a,n)},this.addContentHookByIdName=function(e,a){var n;switch(e[0]){case"<":case"[":n=e.substring(0,1),e=e.substring(1)}return this.addContentHookById(e,a,n)},this.addContentHookByIdC=function(e,a){return this.addContentHookById(e,a,"[")},this.addContentHookByIdB=function(e,a){return this.addContentHookById(e,a,"[")},this.removeContentHook=function(e){if(!e)return!1;if(!e.id)return!1;if(!a[e.id])return!1;var n=a[e.id];n.sepfield&&jQuery(n.sepfield).remove();for(var t in n.fields)jQuery(n.fields[t]).remove();return jQuery(e).removeClass("qtranxs-translatable"),delete a[e.id],!0};var t=[];addDisplayHookNode=function(e){if(!e.nodeValue)return 0;var a=qtranxj_get_split_blocks(e.nodeValue);if(!a||!a.length||1==a.length)return 0;var n={};return n.nd=e,n.contents=qtranxj_split_blocks(a),e.nodeValue=n.contents[qTranslateConfig.activeLanguage],t.push(n),1};var i=[];if(addDisplayHookAttr=function(e){if(!e.value)return 0;var a=qtranxj_get_split_blocks(e.value);if(!a||!a.length||1==a.length)return 0;var n={};return n.nd=e,n.contents=qtranxj_split_blocks(a),e.value=n.contents[qTranslateConfig.activeLanguage],i.push(n),1},addDisplayHook=function(e){if(!e||!e.tagName)return 0;switch(e.tagName){case"TEXTAREA":return 0;case"INPUT":switch(e.type){case"submit":if(e.value)return addDisplayHookAttr(e);default:return 0}}var a=0;if(e.childNodes&&e.childNodes.length)for(var n=0;n1){var r=[];if(qTranslateConfig.page_config&&qTranslateConfig.page_config.anchors)for(var l=0;l