first commit

This commit is contained in:
2023-09-12 21:41:04 +02:00
commit 3361a7f053
13284 changed files with 2116755 additions and 0 deletions

View File

@@ -0,0 +1,58 @@
jQuery(function () {
"use strict";
jQuery('.editinline').on(
'click', function () {
var lang, parentDiv, editButton, postLink;
parentDiv = jQuery(this).closest('div');
editButton = parentDiv.find('.edit').find('a');
postLink = editButton.attr('href');
lang = postLink.match(/(?=lang=).*.$/).pop().replace('lang=', '');
parseJSONTerms(lang);
}
);
}
);
/**
* This is only used for hierarchical Taxonomies
*
* @param lang String
*/
function parseJSONTerms(lang) {
"use strict";
var JSONString, allTerms, termsInCorrectLang, taxonomy;
JSONString = jQuery('#icl-terms-by-lang').html();
allTerms = JSON.parse(JSONString);
if (allTerms.hasOwnProperty(lang)) {
termsInCorrectLang = allTerms[lang];
for (taxonomy in termsInCorrectLang) {
if (termsInCorrectLang.hasOwnProperty(taxonomy)) {
removeWrongLanguageTerms(termsInCorrectLang[taxonomy], taxonomy);
}
}
}
}
function removeWrongLanguageTerms(termsList, taxonomy) {
"use strict";
var termsUL, termsListElements;
termsUL = jQuery('.' + taxonomy + '-checklist');
termsListElements = termsUL.children('li[id^="' + taxonomy + '"]');
jQuery.each(
termsListElements, function (index, liElement) {
var termId, domElementID;
domElementID = liElement.id;
termId = domElementID.replace(taxonomy + '-', '');
if (termsList.indexOf(termId) === -1) {
jQuery(liElement).hide();
} else {
jQuery(liElement).show();
}
}
);
}