/* Version 2.3.2
It's a simple jQuery plugin that searchs for SVG images on your website and creates PNG versions on the run.
Meaning that you don't have to create different versions of the images yourself.
Copyright (C) 2013 - Dirk Groenen [Bitlabs Development]
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
(function( $ ){
$.fn.svgmagic = function(givenoptions) {
var defaultoptions = {
preloader: false,
testmode: false,
secure: false,
callback: false,
backgroundimage: false,
dumpcache: false
}
var options = $.extend(defaultoptions,givenoptions);
var preloaderTimer = [];
if(options.testmode || !document.createElement('svg').getAttributeNS){
if (typeof JSON == 'undefined') {
if(typeof JSON!=="object"){JSON={}}(function(){"use strict";function f(e){return e<10?"0"+e:e}function quote(e){escapable.lastIndex=0;return escapable.test(e)?'"'+e.replace(escapable,function(e){var t=meta[e];return typeof t==="string"?t:"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+e+'"'}function str(e,t){var n,r,i,s,o=gap,u,a=t[e];if(a&&typeof a==="object"&&typeof a.toJSON==="function"){a=a.toJSON(e)}if(typeof rep==="function"){a=rep.call(t,e,a)}switch(typeof a){case"string":return quote(a);case"number":return isFinite(a)?String(a):"null";case"boolean":case"null":return String(a);case"object":if(!a){return"null"}gap+=indent;u=[];if(Object.prototype.toString.apply(a)==="[object Array]"){s=a.length;for(n=0;n 0){
var i = 0;
$.ajax({
dataType: "json",
method: "POST",
url: "https://svgmagic.bitlabs.nl/converter.php",
data: data,
success: function(response){
var i;
for(i = 0;i < domimages.length; i++){
clearTimeout(preloaderTimer[i]);
domimages[i].attr('src', response.results[i].url);
}
if(options.backgroundimage){
for(i;i < (domimages.length+cssimages.length); i++){
var fakeindex = (i - domimages.length);
cssimages[fakeindex].css('background-image', 'url("'+response.results[i].url+'")');
}
}
if(options.callback){
options.callback();
}
}
});
}
}
return this;
};
}(jQuery));