1/* {WPHOOT modified} */ 2"use strict"; 3 4(function ($) { 5 6 $.fn.circliful = function (options, callback) { 7 8 var settings = $.extend({ 9 // These are the defaults. 10 //startDegree: 0, 11 /* WPHOOT MOD */ 12 percentSign: '', 13 display: 100, 14 displayPrefix: '', 15 displaySuffix: '', 16 /* WPHOOT MOD END */ 17 foregroundColor: "#3498DB", 18 backgroundColor: "#ccc", 19 fillColor: 'none', 20 foregroundBorderWidth: 15, 21 backgroundBorderWidth: 15, 22 fontColor: '#aaa', 23 percent: 100, // 75 /* WPHOOT MOD */ 24 animation: 1, 25 animationStep: 5, 26 icon: 'none', 27 iconSize: '30', 28 iconColor: '#ccc', 29 iconPosition: 'top', 30 target: 0, 31 start: 0, 32 showPercent: 1, 33 percentageTextSize: 22, 34 textAdditionalCss: '', 35 targetPercent: 0, 36 targetTextSize: 17, 37 targetColor: '#2980B9', 38 text: null, 39 textStyle: null, 40 textColor: '#666', 41 multiPercentage: 0, 42 percentages: null 43 }, options); 44 45 return this.each(function () { 46 var circleContainer = $(this); 47 var percent = settings.percent; 48 var display = settings.display; /* WPHOOT MOD */ 49 var iconY = 83; 50 var iconX = 100; 51 var textY = 110; 52 var textX = 100; 53 var additionalCss; 54 var elements; 55 var icon; 56 var backgroundBorderWidth = settings.backgroundBorderWidth; 57 58 if(settings.iconPosition == 'bottom') { 59 iconY = 124; 60 textY = 95; 61 } else if(settings.iconPosition == 'left') { 62 iconX = 80; 63 iconY = 110; 64 textX = 117; 65 } else if(settings.iconPosition == 'middle') { 66 if(settings.multiPercentage == 1) {console.log(typeof settings.percentages == "object") 67 if(typeof settings.percentages == "object") { 68 backgroundBorderWidth = 30; 69 } else { 70 iconY = 110; 71 elements = '<g stroke="' + (settings.backgroundColor != 'none' ? settings.backgroundColor : '#ccc') + '" ><line x1="133" y1="50" x2="140" y2="40" stroke-width="2" /></g>'; 72 elements += '<g stroke="' + (settings.backgroundColor != 'none' ? settings.backgroundColor : '#ccc') + '" ><line x1="140" y1="40" x2="200" y2="40" stroke-width="2" /></g>'; 73 textX = 228; 74 textY = 47; 75 } 76 } else { 77 iconY = 110; 78 elements = '<g stroke="' + (settings.backgroundColor != 'none' ? settings.backgroundColor : '#ccc') + '" ><line x1="133" y1="50" x2="140" y2="40" stroke-width="2" /></g>'; 79 elements += '<g stroke="' + (settings.backgroundColor != 'none' ? settings.backgroundColor : '#ccc') + '" ><line x1="140" y1="40" x2="200" y2="40" stroke-width="2" /></g>'; 80 textX = 175; 81 textY = 35; 82 } 83 } else if(settings.iconPosition == 'right') { 84 iconX = 120; 85 iconY = 110; 86 textX = 80; 87 } 88 89 if(settings.targetPercent > 0) { 90 textY = 95; 91 elements = '<g stroke="' + (settings.backgroundColor != 'none' ? settings.backgroundColor : '#ccc') + '" ><line x1="75" y1="101" x2="125" y2="101" stroke-width="1" /></g>'; 92 /* WPHOOT MOD 93 elements += '<text text-anchor="middle" x="' + textX + '" y="120" style="font-size: ' + settings.targetTextSize + 'px;" fill="' + settings.targetColor + '">' + settings.targetPercent + '%</text>'; */ 94 elements += '<text text-anchor="middle" x="' + textX + '" y="120" style="font-size: ' + settings.targetTextSize + 'px;" fill="' + settings.targetColor + '">' + settings.targetPercent + settings.percentSign + '</text>'; 95 /* WPHOOT MOD END */ 96 elements += '<circle cx="100" cy="100" r="69" fill="none" stroke="' + settings.backgroundColor + '" stroke-width="3" stroke-dasharray="450" transform="rotate(-90,100,100)" />'; 97 elements += '<circle cx="100" cy="100" r="69" fill="none" stroke="' + settings.targetColor + '" stroke-width="3" stroke-dasharray="' + (360 / 100 * settings.targetPercent) + ', 20000" transform="rotate(-90,100,100)" />'; 98 99 } 100 101 if(settings.text != null && settings.multiPercentage == 0) { 102 elements += '<text text-anchor="middle" x="100" y="125" style="' + settings.textStyle + '" fill="' + settings.textColor + '">' + settings.text + '</text>'; 103 } else if(settings.text != null && settings.multiPercentage == 1) { 104 elements += '<text text-anchor="middle" x="228" y="65" style="' + settings.textStyle + '" fill="' + settings.textColor + '">' + settings.text + '</text>'; 105 } 106 107 if (settings.icon != 'none') { 108 icon = '<text text-anchor="middle" x="' + iconX + '" y="' + iconY + '" class="icon" style="font-size: ' + settings.iconSize + 'px" fill="' + settings.iconColor + '">&#x' + settings.icon + '</text>'; 109 } 110 111 circleContainer 112 .addClass('svg-container') 113 .append( 114 /* WPHOOT MOD 115 $('<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 194 186" class="circliful">' + 116 elements + 117 '<circle cx="100" cy="100" r="57" class="border" fill="' + settings.fillColor + '" stroke="' + settings.backgroundColor + '" stroke-width="' + backgroundBorderWidth + '" stroke-dasharray="360" transform="rotate(-90,100,100)" />' + 118 '<circle class="circle" cx="100" cy="100" r="57" class="border" fill="none" stroke="' + settings.foregroundColor + '" stroke-width="' + settings.foregroundBorderWidth + '" stroke-dasharray="0,20000" transform="rotate(-90,100,100)" />' + 119 icon + 120 '<text class="timer" text-anchor="middle" x="' + textX + '" y="' + textY + '" style="font-size: ' + settings.percentageTextSize + 'px; ' + additionalCss + ';' + settings.textAdditionalCss + '" fill="' + settings.fontColor + '">0%</text>') */ 121 $('<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 194 186" class="circliful">' + 122 elements + 123 '<circle cx="100" cy="100" r="'+ ( 100 - 43 ) +'" class="border" fill="' + settings.fillColor + '" stroke="' + settings.backgroundColor + '" stroke-width="' + backgroundBorderWidth + '" stroke-dasharray="360" transform="rotate(-90,100,100)" />' + 124 '<circle class="circle" cx="100" cy="100" r="'+ ( 100 - 43 ) +'" class="border" fill="none" stroke="' + settings.foregroundColor + '" stroke-width="' + settings.foregroundBorderWidth + '" stroke-dasharray="0,20000" transform="rotate(-90,100,100)" />' + 125 icon + 126 '<text class="timer" text-anchor="middle" x="' + textX + '" y="' + textY + '" style="font-size: ' + settings.percentageTextSize + 'px; ' + additionalCss + ';' + settings.textAdditionalCss + '" fill="' + settings.fontColor + '">0' + settings.percentSign + '</text>') 127 /* WPHOOT MOD END */ 128 ); 129 130 var circle = circleContainer.find('.circle'); 131 var myTimer = circleContainer.find('.timer'); 132 var interval = 30; 133 var angle = 0; 134 var angleIncrement = settings.animationStep; 135 var last = 0; 136 var summary = 0; 137 var oneStep = 0; 138 139 if (settings.start > 0 && settings.target > 0) { 140 percent = settings.start / (settings.target / 100); 141 oneStep = settings.target / 100; 142 } 143 144 if (settings.animation == 1) { 145 var timer = window.setInterval(function () { 146 if ((angle) >= (360 / 100 * percent)) { 147 window.clearInterval(timer); 148 last = 1; 149 } else { 150 angle += angleIncrement; 151 summary += oneStep; 152 } 153 154 if (angle / 3.6 >= percent && last == 1) { 155 angle = 3.6 * percent; 156 } 157 158 if (summary > settings.target && last == 1) { 159 summary = settings.target; 160 } 161 162 circle 163 .attr("stroke-dasharray", angle + ", 20000"); 164 165 if (settings.showPercent == 1) { 166 /* WPHOOT MOD 167 myTimer 168 .text(parseInt(angle / 360 * 100) + '%'); */ 169 if ( settings.percentSign ) 170 myTimer 171 .text(parseInt(angle / 360 * 100) + settings.percentSign); 172 else 173 myTimer
174 .text(settings.displayPrefix + parseInt(angle / (3.6 * percent) * settings.display ) + settings.displaySuffix); 175 /* WPHOOT MOD END */ 176 } else { 177 myTimer 178 .text(summary); 179 } 180 181 }.bind(circle), interval); 182 } else { 183 circle 184 .attr("stroke-dasharray", (360 / 100 * percent) + ", 20000"); 185 186 if (settings.showPercent == 1) { 187 /* WPHOOT MOD 188 myTimer 189 .text(percent + '%'); */ 190 if ( settings.percentSign ) 191 myTimer 192 .text(display + settings.percentSign); 193 else 194 myTimer 195 .text(settings.displayPrefix + display + settings.displaySuffix); 196 /* WPHOOT MOD END */ 197 } else { 198 myTimer 199 .text(settings.target); 200 } 201 } 202 }); 203 } 204 205}(jQuery));
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.