Initial commit

This commit is contained in:
ayakael 2025-03-31 12:02:18 -04:00
commit 57a2089dd9
No known key found for this signature in database
GPG key ID: 70904985A46AF9AF
1541 changed files with 595392 additions and 0 deletions

View file

@ -0,0 +1 @@
jQuery(document).ready(function($){function i(){jQuery.ajax({url:ajaxurl,data:{action:"bodhi_svgs_dismiss_admin_notice"}})}$(".svgs-upgrade-notice .notice-dismiss").click(i)});

View file

@ -0,0 +1 @@
jQuery(document).ready((function(t){(bodhisvgsInlineSupport=function(){if("true"===ForceInlineSVGActive&&jQuery("img").each((function(){void 0!==jQuery(this).attr("src")&&!1!==jQuery(this).attr("src")&&jQuery(this).attr("src").match(/\.(svg)/)&&(jQuery(this).hasClass(cssTarget.ForceInlineSVG)||jQuery(this).addClass(cssTarget.ForceInlineSVG))})),String.prototype.endsWith||(String.prototype.endsWith=function(t,e){var r=this.toString();("number"!=typeof e||!isFinite(e)||Math.floor(e)!==e||e>r.length)&&(e=r.length),e-=t.length;var s=r.lastIndexOf(t,e);return-1!==s&&s===e}),String.prototype.endsWith=function(t){var e=this.length-t.length;return e>=0&&this.lastIndexOf(t)===e},"true"===ForceInlineSVGActive)var e="img."!==cssTarget.Bodhi?cssTarget.Bodhi:"img.style-svg";else var e="img."!==cssTarget?cssTarget:"img.style-svg";t(e).each((function(e){var r=jQuery(this),s=r.attr("id"),i=r.attr("class"),n=r.attr("src");n.endsWith("svg")&&t.get(n,(function(n){var a=t(n).find("svg"),c=a.attr("id");void 0===s?void 0===c?(s="svg-replaced-"+e,a=a.attr("id",s)):s=c:a=a.attr("id",s),void 0!==i&&(a=a.attr("class",i+" replaced-svg svg-replaced-"+e)),a=a.removeAttr("xmlns:a"),r.replaceWith(a),t(document).trigger("svg.loaded",[s])}),"xml")}))})()}));

View file

@ -0,0 +1,16 @@
jQuery(document).ready(function ($) {
function svgsDismissNotice(){
jQuery.ajax({
url: ajaxurl,
data: {
action: 'bodhi_svgs_dismiss_admin_notice'
}
});
}
$('.svgs-upgrade-notice .notice-dismiss').click(svgsDismissNotice);
});

View file

@ -0,0 +1,110 @@
jQuery(document).ready(function ($) {
// Wrap in IIFE so that it can be called again later as bodhisvgsInlineSupport();
(bodhisvgsInlineSupport = function() {
// If force inline SVG option is active then add class
if ( ForceInlineSVGActive === 'true' ) {
// Find all SVG inside img and add class if it hasn't got it
jQuery('img').each(function() {
// Check if the SRC attribute is present at all
if ( typeof jQuery(this).attr('src') !== typeof undefined && jQuery(this).attr('src') !== false) {
// Pick only those with the extension we want
if ( jQuery(this).attr('src').match(/\.(svg)/) ) {
// Add our class name
if ( !jQuery(this).hasClass(cssTarget.ForceInlineSVG) ) {
jQuery(this).addClass(cssTarget.ForceInlineSVG);
}
}
}
});
}
// Polyfill to support all ye old browsers
// delete when not needed in the future
if (!String.prototype.endsWith) {
String.prototype.endsWith = function(searchString, position) {
var subjectString = this.toString();
if (typeof position !== 'number' || !isFinite(position) || Math.floor(position) !== position || position > subjectString.length) {
position = subjectString.length;
}
position -= searchString.length;
var lastIndex = subjectString.lastIndexOf(searchString, position);
return lastIndex !== -1 && lastIndex === position;
};
} // end polyfill
// Another snippet to support IE11
String.prototype.endsWith = function(pattern) {
var d = this.length - pattern.length;
return d >= 0 && this.lastIndexOf(pattern) === d;
};
// End snippet to support IE11
// Check to see if user set alternate class
if ( ForceInlineSVGActive === 'true' ) {
var target = ( cssTarget.Bodhi !== 'img.' ? cssTarget.Bodhi : 'img.style-svg' );
} else {
var target = ( cssTarget !== 'img.' ? cssTarget : 'img.style-svg' );
}
$(target).each(function(index){
var $img = jQuery(this);
var imgID = $img.attr('id');
var imgClass = $img.attr('class');
var imgURL = $img.attr('src');
// Set svg size to the original img size
// var imgWidth = $img.attr('width');
// var imgHeight = $img.attr('height');
if (!imgURL.endsWith('svg')) {
return;
}
$.get(imgURL, function(data) {
// Get the SVG tag, ignore the rest
var $svg = $(data).find('svg');
var svgID = $svg.attr('id');
// Add replaced image's ID to the new SVG if necessary
if(typeof imgID === 'undefined') {
if(typeof svgID === 'undefined') {
imgID = 'svg-replaced-'+index;
$svg = $svg.attr('id', imgID);
} else {
imgID = svgID;
}
} else {
$svg = $svg.attr('id', imgID);
}
// Add replaced image's classes to the new SVG
if(typeof imgClass !== 'undefined') {
$svg = $svg.attr('class', imgClass+' replaced-svg svg-replaced-'+index);
}
// Remove any invalid XML tags as per http://validator.w3.org
$svg = $svg.removeAttr('xmlns:a');
// Add size attributes
// $svg = $svg.attr('width', imgWidth);
// $svg = $svg.attr('height', imgHeight);
// Replace image with new SVG
$img.replaceWith($svg);
$(document).trigger('svg.loaded', [imgID]);
}, 'xml');
});
})(); // Execute immediately
});