Showing
6 changed files
with
1115 additions
and
0 deletions
static/js/chart-custom.js
0 → 100644
This diff could not be displayed because it is too large.
static/js/countdown.js
0 → 100644
| 1 | +function getTimeRemaining(endtime) { | ||
| 2 | + const total = Date.parse(endtime) - Date.parse(new Date()); | ||
| 3 | + const seconds = Math.floor((total / 1000) % 60); | ||
| 4 | + const minutes = Math.floor((total / 1000 / 60) % 60); | ||
| 5 | + const hours = Math.floor((total / (1000 * 60 * 60)) % 24); | ||
| 6 | + const days = Math.floor(total / (1000 * 60 * 60 * 24)); | ||
| 7 | + | ||
| 8 | + return { | ||
| 9 | + total, | ||
| 10 | + days, | ||
| 11 | + hours, | ||
| 12 | + minutes, | ||
| 13 | + seconds | ||
| 14 | + }; | ||
| 15 | + } | ||
| 16 | + | ||
| 17 | + function initializeClock(elem, endtime) { | ||
| 18 | + const clock = document.querySelector(elem) | ||
| 19 | + const daysSpan = clock.querySelector('[data-days]') | ||
| 20 | + const hoursSpan = clock.querySelector('[data-hours]') | ||
| 21 | + const minutesSpan = clock.querySelector('[data-minutes]') | ||
| 22 | + const secondsSpan = clock.querySelector('[data-seconds]') | ||
| 23 | + | ||
| 24 | + function updateClock() { | ||
| 25 | + const t = getTimeRemaining(endtime) | ||
| 26 | + | ||
| 27 | + daysSpan.innerHTML = t.days | ||
| 28 | + hoursSpan.innerHTML = ('0' + t.hours).slice(-2) | ||
| 29 | + minutesSpan.innerHTML = ('0' + t.minutes).slice(-2) | ||
| 30 | + secondsSpan.innerHTML = ('0' + t.seconds).slice(-2) | ||
| 31 | + | ||
| 32 | + if (t.total <= 0) { | ||
| 33 | + clearInterval(timeinterval) | ||
| 34 | + } | ||
| 35 | + } | ||
| 36 | + | ||
| 37 | + updateClock() | ||
| 38 | + const timeinterval = setInterval(updateClock, 1000) | ||
| 39 | + } | ||
| 40 | + | ||
| 41 | + let time = document.querySelector('.countdown').getAttribute('data-date') | ||
| 42 | + if (time == undefined) { | ||
| 43 | + time = Date.parse(new Date()) + 15 * 24 * 60 * 60 * 1000 | ||
| 44 | + } | ||
| 45 | + const deadline = new Date(time) | ||
| 46 | + initializeClock('.countdown', deadline) |
static/js/customizer.js
0 → 100644
| 1 | +(function (jQuery) { | ||
| 2 | + "use strict"; | ||
| 3 | + // data-mode="click" for using event | ||
| 4 | + // data-dark="false" for property | ||
| 5 | + // icon class // la-sun // la-moon | ||
| 6 | + const storageDark = localStorage.getItem('dark') | ||
| 7 | + if($('body').hasClass('dark')){ | ||
| 8 | + changeMode('true'); | ||
| 9 | + } else { | ||
| 10 | + changeMode('false'); | ||
| 11 | + } | ||
| 12 | + if (storageDark !== 'null') { | ||
| 13 | + changeMode(storageDark) | ||
| 14 | + } | ||
| 15 | + jQuery(document).on("change", '.change-mode input[type="checkbox"]' ,function (e) { | ||
| 16 | + const dark = $(this).attr('data-active'); | ||
| 17 | + if (dark === 'true') { | ||
| 18 | + $(this).attr('data-active','false') | ||
| 19 | + } else { | ||
| 20 | + $(this).attr('data-active','true') | ||
| 21 | + } | ||
| 22 | + changeMode(dark) | ||
| 23 | + }) | ||
| 24 | + function changeMode (dark) { | ||
| 25 | + const body = jQuery('body') | ||
| 26 | + if (dark === 'true') { | ||
| 27 | + // $('[data-mode="toggle"]').find('i.a-right').removeClass('ri-sun-line'); | ||
| 28 | + // $('[data-mode="toggle"]').find('i.a-left').addClass('ri-moon-clear-line'); | ||
| 29 | + $('#dark-mode').prop('checked', true).attr('data-active', 'false') | ||
| 30 | + $('.darkmode-logo').removeClass('d-none') | ||
| 31 | + $('.light-logo').addClass('d-none') | ||
| 32 | + body.addClass('dark') | ||
| 33 | + dark = true | ||
| 34 | + } else { | ||
| 35 | + // $('[data-mode="toggle"]').find('i.a-left').removeClass('ri-moon-clear-line'); | ||
| 36 | + // $('[data-mode="toggle"]').find('i.a-right').addClass('ri-sun-line'); | ||
| 37 | + $('#dark-mode').prop('checked', false).attr('data-active', 'true'); | ||
| 38 | + $('.light-logo').removeClass('d-none') | ||
| 39 | + $('.darkmode-logo').addClass('d-none') | ||
| 40 | + body.removeClass('dark') | ||
| 41 | + dark = false | ||
| 42 | + } | ||
| 43 | + updateLocalStorage(dark) | ||
| 44 | + const event = new CustomEvent("ChangeColorMode", {detail: {dark: dark} }); | ||
| 45 | + document.dispatchEvent(event); | ||
| 46 | + } | ||
| 47 | + function updateLocalStorage(dark) { | ||
| 48 | + localStorage.setItem('dark', dark) | ||
| 49 | + } | ||
| 50 | + | ||
| 51 | +})(jQuery) |
static/js/flex-tree.min.js
0 → 100644
| 1 | +/*! jQuery Flex Tree 1.2.0 2020-08-19 */ | ||
| 2 | +!function(a){var b="flexTree",c={};a.fn[b]=function(b){b=a.extend(!0,{id:void 0,targetElement:a(this),type:void 0,debug:!1,name:"flex_tree",items:{},className:"flex-tree",buildTree:!0,collapsed:!1,collapsable:!0,addControlOnParent:!0,threeState:!0},c,b),!1===b.collapsable&&(b.collapsed=!1),!1===b.addControlOnParent&&(b.threeState=!1);var d;if(b.buildTree){d=a("<ul/>").attr("class",b.className).attr("id",b.id);var e=function(b){b=a.extend(!0,{items:{},ul:d,collapsed:!1,collapsable:!0,addControlOnParent:!0,threeState:!0},b),a.each(b.items,function(c,d){if("object"==typeof d.childrens&&d.childrens.length){var f=a("<li/>");!b.addControlOnParent||"checkbox"!==b.type&&"radio"!==b.type||f.append(a("<input/>").attr("type",b.type).attr("name","radio"===b.type||!1===b.threeState?d.name||b.name:d.name).attr("name",d.name).attr("value",d.value).attr("class","node").attr("id",d.id).prop("checked",d.checked)),f.append(a('<span class="node"/> ').addClass(b.collapsable?b.collapsed?"open":"closed":"").append(a("<label/>").append(d.label).attr("class","node")));var g=a("<ul/>");b.ul.append(f),f.append(g),!0===b.collapsed&&g.hide(),e({items:d.childrens,name:b.name,ul:g,collapsed:b.collapsed,collapsable:b.collapsable,type:b.type,addControlOnParent:b.addControlOnParent,threeState:b.threeState})}else b.ul.append(a("<li/>").append(a("<label/>").append("undefined"!=typeof b.type?a("<input/>").attr("type",b.type).attr("name","checkbox"===b.type?d.name||b.name:b.name).attr("value",d.value).attr("class","leaf").attr("id",d.id).prop("checked",d.checked):void 0).append(d.label)))})};e(b),a(b.targetElement).append(d)}else d=b.targetElement,d.addClass(b.className);if(b.collapsable&&a("li span.node",d).on("click",function(b){a(this).toggleClass("closed").toggleClass("open").next().toggle(200)}),b.threeState&&"checkbox"===b.type){a('input[type="checkbox"].node',d).on("click",function(b){a(this).removeClass("indeterminate").prop("indeterminate",!1);var c=a(this);c.parent().find('ul input[type="checkbox"]').each(function(){a(this).prop("checked",c.prop("checked")).prop("indeterminate",!1).removeClass("indeterminate")})});var f=function(){var b=a(this).closest("ul").prevAll('input[type="checkbox"].node');if(b.length){a(this).prop("checked")||b.prop("checked",!1);var c=a(this).prop("checked"),d=a(this).prop("checked");a(this).closest("li").siblings("li").find("input:first").each(function(){a(this).prop("checked")&&!0!==a(this).prop("indeterminate")||(c=!1),(a(this).prop("checked")||!0===a(this).prop("indeterminate"))&&(d=!0)}),d||!0===a(this).prop("indeterminate")?b.addClass("indeterminate").prop("indeterminate",!0):b.removeClass("indeterminate").prop("indeterminate",!1),c&&b.prop("checked",!0).prop("indeterminate",!1).removeClass("indeterminate"),f.apply(b)}};a('input[type="checkbox"]',d).on("click",f),a('input[type="checkbox"].leaf',d).each(function(){f.apply(this)})}}}(jQuery); |
static/js/table-treeview.js
0 → 100644
| 1 | + | ||
| 2 | + $(function () { | ||
| 3 | + var | ||
| 4 | + $table = $('#tree-table-1'), | ||
| 5 | + rows = $table.find('tr'); | ||
| 6 | + | ||
| 7 | + rows.each(function (index, row) { | ||
| 8 | + var | ||
| 9 | + $row = $(row), | ||
| 10 | + level = $row.data('level'), | ||
| 11 | + id = $row.data('id'), | ||
| 12 | + $columnName = $row.find('td[data-column="name"]'), | ||
| 13 | + children = $table.find('tr[data-parent="' + id + '"]'); | ||
| 14 | + | ||
| 15 | + if (children.length) { | ||
| 16 | + var expander = $columnName.prepend('' + | ||
| 17 | + '<span class="treegrid-expander glyphicon glyphicon-chevron-right"></span>' + | ||
| 18 | + ''); | ||
| 19 | + | ||
| 20 | + children.hide(); | ||
| 21 | + | ||
| 22 | + expander.on('click', function (e) { | ||
| 23 | + var $target = $(e.target); | ||
| 24 | + if ($target.hasClass('glyphicon-chevron-right')) { | ||
| 25 | + $target | ||
| 26 | + .removeClass('glyphicon-chevron-right') | ||
| 27 | + .addClass('glyphicon-chevron-down'); | ||
| 28 | + | ||
| 29 | + children.show(); | ||
| 30 | + } else { | ||
| 31 | + $target | ||
| 32 | + .removeClass('glyphicon-chevron-down') | ||
| 33 | + .addClass('glyphicon-chevron-right'); | ||
| 34 | + | ||
| 35 | + reverseHide($table, $row); | ||
| 36 | + } | ||
| 37 | + }); | ||
| 38 | + } | ||
| 39 | + | ||
| 40 | + $columnName.prepend('' + | ||
| 41 | + '<span class="treegrid-indent" style="width:' + 15 * level + 'px"></span>' + | ||
| 42 | + ''); | ||
| 43 | + }); | ||
| 44 | + | ||
| 45 | + // Reverse hide all elements | ||
| 46 | + reverseHide = function (table, element) { | ||
| 47 | + var | ||
| 48 | + $element = $(element), | ||
| 49 | + id = $element.data('id'), | ||
| 50 | + children = table.find('tr[data-parent="' + id + '"]'); | ||
| 51 | + | ||
| 52 | + if (children.length) { | ||
| 53 | + children.each(function (i, e) { | ||
| 54 | + reverseHide(table, e); | ||
| 55 | + }); | ||
| 56 | + | ||
| 57 | + $element | ||
| 58 | + .find('.glyphicon-chevron-down') | ||
| 59 | + .removeClass('glyphicon-chevron-down') | ||
| 60 | + .addClass('glyphicon-chevron-right'); | ||
| 61 | + | ||
| 62 | + children.hide(); | ||
| 63 | + } | ||
| 64 | + }; | ||
| 65 | +}); | ||
| 66 | + | ||
| 67 | + | ||
| 68 | + // table 2 | ||
| 69 | + $(function () { | ||
| 70 | + var | ||
| 71 | + $table = $('#tree-table-2'), | ||
| 72 | + rows = $table.find('tr'); | ||
| 73 | + | ||
| 74 | + rows.each(function (index, row) { | ||
| 75 | + var | ||
| 76 | + $row = $(row), | ||
| 77 | + level = $row.data('level'), | ||
| 78 | + id = $row.data('id'), | ||
| 79 | + $columnName = $row.find('td[data-column="name"]'), | ||
| 80 | + children = $table.find('tr[data-parent="' + id + '"]'); | ||
| 81 | + | ||
| 82 | + if (children.length) { | ||
| 83 | + var expander = $columnName.prepend('' + | ||
| 84 | + '<span class="treegrid-expander glyphicon glyphicon-plus"></span>' + | ||
| 85 | + ''); | ||
| 86 | + | ||
| 87 | + children.hide(); | ||
| 88 | + | ||
| 89 | + expander.on('click', function (e) { | ||
| 90 | + var $target = $(e.target); | ||
| 91 | + if ($target.hasClass('glyphicon-plus')) { | ||
| 92 | + $target | ||
| 93 | + .removeClass('glyphicon-plus') | ||
| 94 | + .addClass('glyphicon-minus'); | ||
| 95 | + | ||
| 96 | + children.show(); | ||
| 97 | + } else { | ||
| 98 | + $target | ||
| 99 | + .removeClass('glyphicon-minus') | ||
| 100 | + .addClass('glyphicon-plus'); | ||
| 101 | + | ||
| 102 | + reverseHide($table, $row); | ||
| 103 | + } | ||
| 104 | + }); | ||
| 105 | + } | ||
| 106 | + | ||
| 107 | + $columnName.prepend('' + | ||
| 108 | + '<span class="treegrid-indent" style="width:' + 15 * level + 'px"></span>' + | ||
| 109 | + ''); | ||
| 110 | + }); | ||
| 111 | + | ||
| 112 | + // Reverse hide all elements | ||
| 113 | + reverseHide = function (table, element) { | ||
| 114 | + var | ||
| 115 | + $element = $(element), | ||
| 116 | + id = $element.data('id'), | ||
| 117 | + children = table.find('tr[data-parent="' + id + '"]'); | ||
| 118 | + | ||
| 119 | + if (children.length) { | ||
| 120 | + children.each(function (i, e) { | ||
| 121 | + reverseHide(table, e); | ||
| 122 | + }); | ||
| 123 | + | ||
| 124 | + $element | ||
| 125 | + .find('.glyphicon-chevron-down') | ||
| 126 | + .removeClass('glyphicon-chevron-down') | ||
| 127 | + .addClass('glyphicon-chevron-right'); | ||
| 128 | + | ||
| 129 | + children.hide(); | ||
| 130 | + } | ||
| 131 | + }; | ||
| 132 | +}); | ||
| 133 | + | ||
| 134 | +// table 3 | ||
| 135 | + $(function () { | ||
| 136 | + var | ||
| 137 | + $table = $('#tree-table-3'), | ||
| 138 | + rows = $table.find('tr'); | ||
| 139 | + | ||
| 140 | + rows.each(function (index, row) { | ||
| 141 | + var | ||
| 142 | + $row = $(row), | ||
| 143 | + level = $row.data('level'), | ||
| 144 | + id = $row.data('id'), | ||
| 145 | + $columnName = $row.find('td[data-column="name"]'), | ||
| 146 | + children = $table.find('tr[data-parent="' + id + '"]'); | ||
| 147 | + | ||
| 148 | + if (children.length) { | ||
| 149 | + var expander = $columnName.prepend('' + | ||
| 150 | + '<span class="treegrid-expander glyphicon glyphicon-chevron-right"></span>' + | ||
| 151 | + ''); | ||
| 152 | + | ||
| 153 | + children.hide(); | ||
| 154 | + | ||
| 155 | + expander.on('click', function (e) { | ||
| 156 | + var $target = $(e.target); | ||
| 157 | + if ($target.hasClass('glyphicon-chevron-right')) { | ||
| 158 | + $target | ||
| 159 | + .removeClass('glyphicon-chevron-right') | ||
| 160 | + .addClass('glyphicon-chevron-down'); | ||
| 161 | + | ||
| 162 | + children.show(); | ||
| 163 | + } else { | ||
| 164 | + $target | ||
| 165 | + .removeClass('glyphicon-chevron-down') | ||
| 166 | + .addClass('glyphicon-chevron-right'); | ||
| 167 | + | ||
| 168 | + reverseHide($table, $row); | ||
| 169 | + } | ||
| 170 | + }); | ||
| 171 | + } | ||
| 172 | + | ||
| 173 | + $columnName.prepend('' + | ||
| 174 | + '<span class="treegrid-indent" style="width:' + 15 * level + 'px"></span>' + | ||
| 175 | + ''); | ||
| 176 | + }); | ||
| 177 | + | ||
| 178 | + // Reverse hide all elements | ||
| 179 | + reverseHide = function (table, element) { | ||
| 180 | + var | ||
| 181 | + $element = $(element), | ||
| 182 | + id = $element.data('id'), | ||
| 183 | + children = table.find('tr[data-parent="' + id + '"]'); | ||
| 184 | + | ||
| 185 | + if (children.length) { | ||
| 186 | + children.each(function (i, e) { | ||
| 187 | + reverseHide(table, e); | ||
| 188 | + }); | ||
| 189 | + | ||
| 190 | + $element | ||
| 191 | + .find('.glyphicon-chevron-down') | ||
| 192 | + .removeClass('glyphicon-chevron-down') | ||
| 193 | + .addClass('glyphicon-chevron-right'); | ||
| 194 | + | ||
| 195 | + children.hide(); | ||
| 196 | + } | ||
| 197 | + }; | ||
| 198 | +}); | ||
| 199 | + | ||
| 200 | + // table 4 | ||
| 201 | + $(function () { | ||
| 202 | + var | ||
| 203 | + $table = $('#tree-table-4'), | ||
| 204 | + rows = $table.find('tr'); | ||
| 205 | + | ||
| 206 | + rows.each(function (index, row) { | ||
| 207 | + var | ||
| 208 | + $row = $(row), | ||
| 209 | + level = $row.data('level'), | ||
| 210 | + id = $row.data('id'), | ||
| 211 | + $columnName = $row.find('td[data-column="name"]'), | ||
| 212 | + children = $table.find('tr[data-parent="' + id + '"]'); | ||
| 213 | + | ||
| 214 | + if (children.length) { | ||
| 215 | + var expander = $columnName.prepend('' + | ||
| 216 | + '<span class="treegrid-expander glyphicon glyphicon-chevron-right"></span>' + | ||
| 217 | + ''); | ||
| 218 | + | ||
| 219 | + children.hide(); | ||
| 220 | + | ||
| 221 | + expander.on('click', function (e) { | ||
| 222 | + var $target = $(e.target); | ||
| 223 | + if ($target.hasClass('glyphicon-chevron-right')) { | ||
| 224 | + $target | ||
| 225 | + .removeClass('glyphicon-chevron-right') | ||
| 226 | + .addClass('glyphicon-chevron-down'); | ||
| 227 | + | ||
| 228 | + children.show(); | ||
| 229 | + } else { | ||
| 230 | + $target | ||
| 231 | + .removeClass('glyphicon-chevron-down') | ||
| 232 | + .addClass('glyphicon-chevron-right'); | ||
| 233 | + | ||
| 234 | + reverseHide($table, $row); | ||
| 235 | + } | ||
| 236 | + }); | ||
| 237 | + } | ||
| 238 | + | ||
| 239 | + $columnName.prepend('' + | ||
| 240 | + '<span class="treegrid-indent" style="width:' + 15 * level + 'px"></span>' + | ||
| 241 | + ''); | ||
| 242 | + }); | ||
| 243 | + | ||
| 244 | + // Reverse hide all elements | ||
| 245 | + reverseHide = function (table, element) { | ||
| 246 | + var | ||
| 247 | + $element = $(element), | ||
| 248 | + id = $element.data('id'), | ||
| 249 | + children = table.find('tr[data-parent="' + id + '"]'); | ||
| 250 | + | ||
| 251 | + if (children.length) { | ||
| 252 | + children.each(function (i, e) { | ||
| 253 | + reverseHide(table, e); | ||
| 254 | + }); | ||
| 255 | + | ||
| 256 | + $element | ||
| 257 | + .find('.glyphicon-chevron-down') | ||
| 258 | + .removeClass('glyphicon-chevron-down') | ||
| 259 | + .addClass('glyphicon-chevron-right'); | ||
| 260 | + | ||
| 261 | + children.hide(); | ||
| 262 | + } | ||
| 263 | + }; | ||
| 264 | +}); | ||
| 265 | + // table 5 | ||
| 266 | + $(function () { | ||
| 267 | + var | ||
| 268 | + $table = $('#tree-table-5'), | ||
| 269 | + rows = $table.find('tr'); | ||
| 270 | + | ||
| 271 | + rows.each(function (index, row) { | ||
| 272 | + var | ||
| 273 | + $row = $(row), | ||
| 274 | + level = $row.data('level'), | ||
| 275 | + id = $row.data('id'), | ||
| 276 | + $columnName = $row.find('td[data-column="name"]'), | ||
| 277 | + children = $table.find('tr[data-parent="' + id + '"]'); | ||
| 278 | + | ||
| 279 | + if (children.length) { | ||
| 280 | + var expander = $columnName.prepend('' + | ||
| 281 | + '<span class="treegrid-expander glyphicon glyphicon-chevron-right"></span>' + | ||
| 282 | + ''); | ||
| 283 | + | ||
| 284 | + children.hide(); | ||
| 285 | + | ||
| 286 | + expander.on('click', function (e) { | ||
| 287 | + var $target = $(e.target); | ||
| 288 | + if ($target.hasClass('glyphicon-chevron-right')) { | ||
| 289 | + $target | ||
| 290 | + .removeClass('glyphicon-chevron-right') | ||
| 291 | + .addClass('glyphicon-chevron-down'); | ||
| 292 | + | ||
| 293 | + children.show(); | ||
| 294 | + } else { | ||
| 295 | + $target | ||
| 296 | + .removeClass('glyphicon-chevron-down') | ||
| 297 | + .addClass('glyphicon-chevron-right'); | ||
| 298 | + | ||
| 299 | + reverseHide($table, $row); | ||
| 300 | + } | ||
| 301 | + }); | ||
| 302 | + } | ||
| 303 | + | ||
| 304 | + $columnName.prepend('' + | ||
| 305 | + '<span class="treegrid-indent" style="width:' + 15 * level + 'px"></span>' + | ||
| 306 | + ''); | ||
| 307 | + }); | ||
| 308 | + | ||
| 309 | + // Reverse hide all elements | ||
| 310 | + reverseHide = function (table, element) { | ||
| 311 | + var | ||
| 312 | + $element = $(element), | ||
| 313 | + id = $element.data('id'), | ||
| 314 | + children = table.find('tr[data-parent="' + id + '"]'); | ||
| 315 | + | ||
| 316 | + if (children.length) { | ||
| 317 | + children.each(function (i, e) { | ||
| 318 | + reverseHide(table, e); | ||
| 319 | + }); | ||
| 320 | + | ||
| 321 | + $element | ||
| 322 | + .find('.glyphicon-chevron-down') | ||
| 323 | + .removeClass('glyphicon-chevron-down') | ||
| 324 | + .addClass('glyphicon-chevron-right'); | ||
| 325 | + | ||
| 326 | + children.hide(); | ||
| 327 | + } | ||
| 328 | + }; | ||
| 329 | +}); | ||
| 330 | + | ||
| 331 | + | ||
| 332 | +// table 6 | ||
| 333 | + $(function () { | ||
| 334 | + var | ||
| 335 | + $table = $('#tree-table-6'), | ||
| 336 | + rows = $table.find('tr'); | ||
| 337 | + | ||
| 338 | + rows.each(function (index, row) { | ||
| 339 | + var | ||
| 340 | + $row = $(row), | ||
| 341 | + level = $row.data('level'), | ||
| 342 | + id = $row.data('id'), | ||
| 343 | + $columnName = $row.find('td[data-column="name"]'), | ||
| 344 | + children = $table.find('tr[data-parent="' + id + '"]'); | ||
| 345 | + | ||
| 346 | + if (children.length) { | ||
| 347 | + var expander = $columnName.prepend('' + | ||
| 348 | + '<span class="treegrid-expander glyphicon glyphicon-chevron-right"></span>' + | ||
| 349 | + ''); | ||
| 350 | + | ||
| 351 | + children.hide(); | ||
| 352 | + | ||
| 353 | + expander.on('click', function (e) { | ||
| 354 | + var $target = $(e.target); | ||
| 355 | + if ($target.hasClass('glyphicon-chevron-right')) { | ||
| 356 | + $target | ||
| 357 | + .removeClass('glyphicon-chevron-right') | ||
| 358 | + .addClass('glyphicon-chevron-down'); | ||
| 359 | + | ||
| 360 | + children.show(); | ||
| 361 | + } else { | ||
| 362 | + $target | ||
| 363 | + .removeClass('glyphicon-chevron-down') | ||
| 364 | + .addClass('glyphicon-chevron-right'); | ||
| 365 | + | ||
| 366 | + reverseHide($table, $row); | ||
| 367 | + } | ||
| 368 | + }); | ||
| 369 | + } | ||
| 370 | + | ||
| 371 | + $columnName.prepend('' + | ||
| 372 | + '<span class="treegrid-indent" style="width:' + 15 * level + 'px"></span>' + | ||
| 373 | + ''); | ||
| 374 | + }); | ||
| 375 | + | ||
| 376 | + // Reverse hide all elements | ||
| 377 | + reverseHide = function (table, element) { | ||
| 378 | + var | ||
| 379 | + $element = $(element), | ||
| 380 | + id = $element.data('id'), | ||
| 381 | + children = table.find('tr[data-parent="' + id + '"]'); | ||
| 382 | + | ||
| 383 | + if (children.length) { | ||
| 384 | + children.each(function (i, e) { | ||
| 385 | + reverseHide(table, e); | ||
| 386 | + }); | ||
| 387 | + | ||
| 388 | + $element | ||
| 389 | + .find('.glyphicon-chevron-down') | ||
| 390 | + .removeClass('glyphicon-chevron-down') | ||
| 391 | + .addClass('glyphicon-chevron-right'); | ||
| 392 | + | ||
| 393 | + children.hide(); | ||
| 394 | + } | ||
| 395 | + }; | ||
| 396 | +}); | ||
| 397 | + | ||
| 398 | +// table 7 | ||
| 399 | + $(function () { | ||
| 400 | + var | ||
| 401 | + $table = $('#tree-table-7'), | ||
| 402 | + rows = $table.find('tr'); | ||
| 403 | + | ||
| 404 | + rows.each(function (index, row) { | ||
| 405 | + var | ||
| 406 | + $row = $(row), | ||
| 407 | + level = $row.data('level'), | ||
| 408 | + id = $row.data('id'), | ||
| 409 | + $columnName = $row.find('td[data-column="name"]'), | ||
| 410 | + children = $table.find('tr[data-parent="' + id + '"]'); | ||
| 411 | + | ||
| 412 | + if (children.length) { | ||
| 413 | + var expander = $columnName.prepend('' + | ||
| 414 | + '<span class="treegrid-expander glyphicon glyphicon-chevron-right"></span>' + | ||
| 415 | + ''); | ||
| 416 | + | ||
| 417 | + children.hide(); | ||
| 418 | + | ||
| 419 | + expander.on('click', function (e) { | ||
| 420 | + var $target = $(e.target); | ||
| 421 | + if ($target.hasClass('glyphicon-chevron-right')) { | ||
| 422 | + $target | ||
| 423 | + .removeClass('glyphicon-chevron-right') | ||
| 424 | + .addClass('glyphicon-chevron-down'); | ||
| 425 | + | ||
| 426 | + children.show(); | ||
| 427 | + } else { | ||
| 428 | + $target | ||
| 429 | + .removeClass('glyphicon-chevron-down') | ||
| 430 | + .addClass('glyphicon-chevron-right'); | ||
| 431 | + | ||
| 432 | + reverseHide($table, $row); | ||
| 433 | + } | ||
| 434 | + }); | ||
| 435 | + } | ||
| 436 | + | ||
| 437 | + $columnName.prepend('' + | ||
| 438 | + '<span class="treegrid-indent" style="width:' + 15 * level + 'px"></span>' + | ||
| 439 | + ''); | ||
| 440 | + }); | ||
| 441 | + | ||
| 442 | + // Reverse hide all elements | ||
| 443 | + reverseHide = function (table, element) { | ||
| 444 | + var | ||
| 445 | + $element = $(element), | ||
| 446 | + id = $element.data('id'), | ||
| 447 | + children = table.find('tr[data-parent="' + id + '"]'); | ||
| 448 | + | ||
| 449 | + if (children.length) { | ||
| 450 | + children.each(function (i, e) { | ||
| 451 | + reverseHide(table, e); | ||
| 452 | + }); | ||
| 453 | + | ||
| 454 | + $element | ||
| 455 | + .find('.glyphicon-chevron-down') | ||
| 456 | + .removeClass('glyphicon-chevron-down') | ||
| 457 | + .addClass('glyphicon-chevron-right'); | ||
| 458 | + | ||
| 459 | + children.hide(); | ||
| 460 | + } | ||
| 461 | + }; | ||
| 462 | +}); | ||
| 463 | + | ||
| 464 | + // table 8 | ||
| 465 | + $(function () { | ||
| 466 | + var | ||
| 467 | + $table = $('#tree-table-8'), | ||
| 468 | + rows = $table.find('tr'); | ||
| 469 | + | ||
| 470 | + rows.each(function (index, row) { | ||
| 471 | + var | ||
| 472 | + $row = $(row), | ||
| 473 | + level = $row.data('level'), | ||
| 474 | + id = $row.data('id'), | ||
| 475 | + $columnName = $row.find('td[data-column="name"]'), | ||
| 476 | + children = $table.find('tr[data-parent="' + id + '"]'); | ||
| 477 | + | ||
| 478 | + if (children.length) { | ||
| 479 | + var expander = $columnName.prepend('' + | ||
| 480 | + '<span class="treegrid-expander glyphicon glyphicon-chevron-right"></span>' + | ||
| 481 | + ''); | ||
| 482 | + | ||
| 483 | + children.hide(); | ||
| 484 | + | ||
| 485 | + expander.on('click', function (e) { | ||
| 486 | + var $target = $(e.target); | ||
| 487 | + if ($target.hasClass('glyphicon-chevron-right')) { | ||
| 488 | + $target | ||
| 489 | + .removeClass('glyphicon-chevron-right') | ||
| 490 | + .addClass('glyphicon-chevron-down'); | ||
| 491 | + | ||
| 492 | + children.show(); | ||
| 493 | + } else { | ||
| 494 | + $target | ||
| 495 | + .removeClass('glyphicon-chevron-down') | ||
| 496 | + .addClass('glyphicon-chevron-right'); | ||
| 497 | + | ||
| 498 | + reverseHide($table, $row); | ||
| 499 | + } | ||
| 500 | + }); | ||
| 501 | + } | ||
| 502 | + | ||
| 503 | + $columnName.prepend('' + | ||
| 504 | + '<span class="treegrid-indent" style="width:' + 15 * level + 'px"></span>' + | ||
| 505 | + ''); | ||
| 506 | + }); | ||
| 507 | + | ||
| 508 | + // Reverse hide all elements | ||
| 509 | + reverseHide = function (table, element) { | ||
| 510 | + var | ||
| 511 | + $element = $(element), | ||
| 512 | + id = $element.data('id'), | ||
| 513 | + children = table.find('tr[data-parent="' + id + '"]'); | ||
| 514 | + | ||
| 515 | + if (children.length) { | ||
| 516 | + children.each(function (i, e) { | ||
| 517 | + reverseHide(table, e); | ||
| 518 | + }); | ||
| 519 | + | ||
| 520 | + $element | ||
| 521 | + .find('.glyphicon-chevron-down') | ||
| 522 | + .removeClass('glyphicon-chevron-down') | ||
| 523 | + .addClass('glyphicon-chevron-right'); | ||
| 524 | + | ||
| 525 | + children.hide(); | ||
| 526 | + } | ||
| 527 | + }; | ||
| 528 | +}); |
static/js/vector-map-custom.js
0 → 100644
| 1 | +var gdpData = { | ||
| 2 | + "AF": 16.63, | ||
| 3 | + "AL": 11.58, | ||
| 4 | + "DZ": 158.97, | ||
| 5 | + "AO": 85.81, | ||
| 6 | + "AG": 1.1, | ||
| 7 | + "AR": 351.02, | ||
| 8 | + "AM": 8.83, | ||
| 9 | + "AU": 1219.72, | ||
| 10 | + "AT": 366.26, | ||
| 11 | + "AZ": 52.17, | ||
| 12 | + "BS": 7.54, | ||
| 13 | + "BH": 21.73, | ||
| 14 | + "BD": 105.4, | ||
| 15 | + "BB": 3.96, | ||
| 16 | + "BY": 52.89, | ||
| 17 | + "BE": 461.33, | ||
| 18 | + "BZ": 1.43, | ||
| 19 | + "BJ": 6.49, | ||
| 20 | + "BT": 1.4, | ||
| 21 | + "BO": 19.18, | ||
| 22 | + "BA": 16.2, | ||
| 23 | + "BW": 12.5, | ||
| 24 | + "BR": 2023.53, | ||
| 25 | + "BN": 11.96, | ||
| 26 | + "BG": 44.84, | ||
| 27 | + "BF": 8.67, | ||
| 28 | + "BI": 1.47, | ||
| 29 | + "KH": 11.36, | ||
| 30 | + "CM": 21.88, | ||
| 31 | + "CA": 1563.66, | ||
| 32 | + "CV": 1.57, | ||
| 33 | + "CF": 2.11, | ||
| 34 | + "TD": 7.59, | ||
| 35 | + "CL": 199.18, | ||
| 36 | + "CN": 5745.13, | ||
| 37 | + "CO": 283.11, | ||
| 38 | + "KM": 0.56, | ||
| 39 | + "CD": 12.6, | ||
| 40 | + "CG": 11.88, | ||
| 41 | + "CR": 35.02, | ||
| 42 | + "CI": 22.38, | ||
| 43 | + "HR": 59.92, | ||
| 44 | + "CY": 22.75, | ||
| 45 | + "CZ": 195.23, | ||
| 46 | + "DK": 304.56, | ||
| 47 | + "DJ": 1.14, | ||
| 48 | + "DM": 0.38, | ||
| 49 | + "DO": 50.87, | ||
| 50 | + "EC": 61.49, | ||
| 51 | + "EG": 216.83, | ||
| 52 | + "SV": 21.8, | ||
| 53 | + "GQ": 14.55, | ||
| 54 | + "ER": 2.25, | ||
| 55 | + "EE": 19.22, | ||
| 56 | + "ET": 30.94, | ||
| 57 | + "FJ": 3.15, | ||
| 58 | + "FI": 231.98, | ||
| 59 | + "FR": 2555.44, | ||
| 60 | + "GA": 12.56, | ||
| 61 | + "GM": 1.04, | ||
| 62 | + "GE": 11.23, | ||
| 63 | + "DE": 3305.9, | ||
| 64 | + "GH": 18.06, | ||
| 65 | + "GR": 305.01, | ||
| 66 | + "GD": 0.65, | ||
| 67 | + "GT": 40.77, | ||
| 68 | + "GN": 4.34, | ||
| 69 | + "GW": 0.83, | ||
| 70 | + "GY": 2.2, | ||
| 71 | + "HT": 6.5, | ||
| 72 | + "HN": 15.34, | ||
| 73 | + "HK": 226.49, | ||
| 74 | + "HU": 132.28, | ||
| 75 | + "IS": 12.77, | ||
| 76 | + "IN": 1430.02, | ||
| 77 | + "ID": 695.06, | ||
| 78 | + "IR": 337.9, | ||
| 79 | + "IQ": 84.14, | ||
| 80 | + "IE": 204.14, | ||
| 81 | + "IL": 201.25, | ||
| 82 | + "IT": 2036.69, | ||
| 83 | + "JM": 13.74, | ||
| 84 | + "JP": 5390.9, | ||
| 85 | + "JO": 27.13, | ||
| 86 | + "KZ": 129.76, | ||
| 87 | + "KE": 32.42, | ||
| 88 | + "KI": 0.15, | ||
| 89 | + "KR": 986.26, | ||
| 90 | + "UNDEFINED": 5.73, | ||
| 91 | + "KW": 117.32, | ||
| 92 | + "KG": 4.44, | ||
| 93 | + "LA": 6.34, | ||
| 94 | + "LV": 23.39, | ||
| 95 | + "LB": 39.15, | ||
| 96 | + "LS": 1.8, | ||
| 97 | + "LR": 0.98, | ||
| 98 | + "LY": 77.91, | ||
| 99 | + "LT": 35.73, | ||
| 100 | + "LU": 52.43, | ||
| 101 | + "MK": 9.58, | ||
| 102 | + "MG": 8.33, | ||
| 103 | + "MW": 5.04, | ||
| 104 | + "MY": 218.95, | ||
| 105 | + "MV": 1.43, | ||
| 106 | + "ML": 9.08, | ||
| 107 | + "MT": 7.8, | ||
| 108 | + "MR": 3.49, | ||
| 109 | + "MU": 9.43, | ||
| 110 | + "MX": 1004.04, | ||
| 111 | + "MD": 5.36, | ||
| 112 | + "MN": 5.81, | ||
| 113 | + "ME": 3.88, | ||
| 114 | + "MA": 91.7, | ||
| 115 | + "MZ": 10.21, | ||
| 116 | + "MM": 35.65, | ||
| 117 | + "NA": 11.45, | ||
| 118 | + "NP": 15.11, | ||
| 119 | + "NL": 770.31, | ||
| 120 | + "NZ": 138, | ||
| 121 | + "NI": 6.38, | ||
| 122 | + "NE": 5.6, | ||
| 123 | + "NG": 206.66, | ||
| 124 | + "NO": 413.51, | ||
| 125 | + "OM": 53.78, | ||
| 126 | + "PK": 174.79, | ||
| 127 | + "PA": 27.2, | ||
| 128 | + "PG": 8.81, | ||
| 129 | + "PY": 17.17, | ||
| 130 | + "PE": 153.55, | ||
| 131 | + "PH": 189.06, | ||
| 132 | + "PL": 438.88, | ||
| 133 | + "PT": 223.7, | ||
| 134 | + "QA": 126.52, | ||
| 135 | + "RO": 158.39, | ||
| 136 | + "RU": 1476.91, | ||
| 137 | + "RW": 5.69, | ||
| 138 | + "WS": 0.55, | ||
| 139 | + "ST": 0.19, | ||
| 140 | + "SA": 434.44, | ||
| 141 | + "SN": 12.66, | ||
| 142 | + "RS": 38.92, | ||
| 143 | + "SC": 0.92, | ||
| 144 | + "SL": 1.9, | ||
| 145 | + "SG": 217.38, | ||
| 146 | + "SK": 86.26, | ||
| 147 | + "SI": 46.44, | ||
| 148 | + "SB": 0.67, | ||
| 149 | + "ZA": 354.41, | ||
| 150 | + "ES": 1374.78, | ||
| 151 | + "LK": 48.24, | ||
| 152 | + "KN": 0.56, | ||
| 153 | + "LC": 1, | ||
| 154 | + "VC": 0.58, | ||
| 155 | + "SD": 65.93, | ||
| 156 | + "SR": 3.3, | ||
| 157 | + "SZ": 3.17, | ||
| 158 | + "SE": 444.59, | ||
| 159 | + "CH": 522.44, | ||
| 160 | + "SY": 59.63, | ||
| 161 | + "TW": 426.98, | ||
| 162 | + "TJ": 5.58, | ||
| 163 | + "TZ": 22.43, | ||
| 164 | + "TH": 312.61, | ||
| 165 | + "TL": 0.62, | ||
| 166 | + "TG": 3.07, | ||
| 167 | + "TO": 0.3, | ||
| 168 | + "TT": 21.2, | ||
| 169 | + "TN": 43.86, | ||
| 170 | + "TR": 729.05, | ||
| 171 | + "TM": 0, | ||
| 172 | + "UG": 17.12, | ||
| 173 | + "UA": 136.56, | ||
| 174 | + "AE": 239.65, | ||
| 175 | + "GB": 2258.57, | ||
| 176 | + "US": 14624.18, | ||
| 177 | + "UY": 40.71, | ||
| 178 | + "UZ": 37.72, | ||
| 179 | + "VU": 0.72, | ||
| 180 | + "VE": 285.21, | ||
| 181 | + "VN": 101.99, | ||
| 182 | + "YE": 30.02, | ||
| 183 | + "ZM": 15.69, | ||
| 184 | + "ZW": 5.57 | ||
| 185 | +}; | ||
| 186 | +$(function () { | ||
| 187 | + if(typeof $.fn.vectorMap !== typeof undefined && $('#world-map-gdp1').length > 0){ | ||
| 188 | + $('#world-map-gdp1').vectorMap({ | ||
| 189 | + map: 'world_mill', | ||
| 190 | + series: { | ||
| 191 | + regions: [{ | ||
| 192 | + normalizeFunction: 'polynomial' | ||
| 193 | + }] | ||
| 194 | + }, | ||
| 195 | + onRegionTipShow: function (e, el, code) { | ||
| 196 | + el.html(el.html() + ' (GDP - ' + gdpData[code] + ')'); | ||
| 197 | + } | ||
| 198 | + }); | ||
| 199 | + } | ||
| 200 | + if(typeof $.fn.vectorMap !== typeof undefined && $('#world-map-gdp').length > 0){ | ||
| 201 | + $('#world-map-gdp').vectorMap({ | ||
| 202 | + map: 'world_mill', | ||
| 203 | + series: { | ||
| 204 | + regions: [{ | ||
| 205 | + values: gdpData, | ||
| 206 | + scale: ['#C8EEFF', '#0071A4'], | ||
| 207 | + normalizeFunction: 'polynomial' | ||
| 208 | + }] | ||
| 209 | + }, | ||
| 210 | + onRegionTipShow: function (e, el, code) { | ||
| 211 | + el.html(el.html() + ' (GDP - ' + gdpData[code] + ')'); | ||
| 212 | + } | ||
| 213 | + }); | ||
| 214 | + } | ||
| 215 | + if(typeof $.fn.vectorMap !== typeof undefined && $('#world-map-markers') > 0){ | ||
| 216 | + $('#world-map-markers').vectorMap({ | ||
| 217 | + map: 'world_mill', | ||
| 218 | + scaleColors: ['#C8EEFF', '#0071A4'], | ||
| 219 | + normalizeFunction: 'polynomial', | ||
| 220 | + hoverOpacity: 0.7, | ||
| 221 | + hoverColor: false, | ||
| 222 | + markerStyle: { | ||
| 223 | + initial: { | ||
| 224 | + fill: '#F8E23B', | ||
| 225 | + stroke: '#383f47' | ||
| 226 | + } | ||
| 227 | + }, | ||
| 228 | + backgroundColor: '#383f47', | ||
| 229 | + lines: [ | ||
| 230 | + { points: [[41.90, 12.45], [43.73, 7.41], [-0.52, 166.93]], text: "first road" }, | ||
| 231 | + { points: [[31.52, -87.37], [21.18, -157.49]], text: "second path" } | ||
| 232 | + ], | ||
| 233 | + markers: [ | ||
| 234 | + { latLng: [41.90, 12.45], name: 'Vatican City' }, | ||
| 235 | + { latLng: [43.73, 7.41], name: 'Monaco' }, | ||
| 236 | + { latLng: [-0.52, 166.93], name: 'Nauru' }, | ||
| 237 | + { latLng: [-8.51, 179.21], name: 'Tuvalu' }, | ||
| 238 | + { latLng: [43.93, 12.46], name: 'San Marino' }, | ||
| 239 | + { latLng: [47.14, 9.52], name: 'Liechtenstein' }, | ||
| 240 | + { latLng: [7.11, 171.06], name: 'Marshall Islands' }, | ||
| 241 | + { latLng: [17.3, -62.73], name: 'Saint Kitts and Nevis' }, | ||
| 242 | + { latLng: [3.2, 73.22], name: 'Maldives' }, | ||
| 243 | + { latLng: [35.88, 14.5], name: 'Malta' }, | ||
| 244 | + { latLng: [12.05, -61.75], name: 'Grenada' }, | ||
| 245 | + { latLng: [13.16, -61.23], name: 'Saint Vincent and the Grenadines' }, | ||
| 246 | + { latLng: [13.16, -59.55], name: 'Barbados' }, | ||
| 247 | + { latLng: [17.11, -61.85], name: 'Antigua and Barbuda' }, | ||
| 248 | + { latLng: [-4.61, 55.45], name: 'Seychelles' }, | ||
| 249 | + { latLng: [7.35, 134.46], name: 'Palau' }, | ||
| 250 | + { latLng: [42.5, 1.51], name: 'Andorra' }, | ||
| 251 | + { latLng: [14.01, -60.98], name: 'Saint Lucia' }, | ||
| 252 | + { latLng: [6.91, 158.18], name: 'Federated States of Micronesia' }, | ||
| 253 | + { latLng: [1.3, 103.8], name: 'Singapore' }, | ||
| 254 | + { latLng: [1.46, 173.03], name: 'Kiribati' }, | ||
| 255 | + { latLng: [-21.13, -175.2], name: 'Tonga' }, | ||
| 256 | + { latLng: [15.3, -61.38], name: 'Dominica' }, | ||
| 257 | + { latLng: [-20.2, 57.5], name: 'Mauritius' }, | ||
| 258 | + { latLng: [26.02, 50.55], name: 'Bahrain' }, | ||
| 259 | + { latLng: [0.33, 6.73], name: 'São Tomé and Príncipe' } | ||
| 260 | + ] | ||
| 261 | + }); | ||
| 262 | + } | ||
| 263 | +}) | ||
| 264 | +$(function () { | ||
| 265 | + var map, | ||
| 266 | + markers = [ | ||
| 267 | + { latLng: [52.50, 13.39], name: 'Berlin' }, | ||
| 268 | + { latLng: [53.56, 10.00], name: 'Hamburg' }, | ||
| 269 | + { latLng: [48.13, 11.56], name: 'Munich' }, | ||
| 270 | + { latLng: [50.95, 6.96], name: 'Cologne' }, | ||
| 271 | + { latLng: [50.11, 8.68], name: 'Frankfurt am Main' }, | ||
| 272 | + { latLng: [48.77, 9.17], name: 'Stuttgart' }, | ||
| 273 | + { latLng: [51.23, 6.78], name: 'Düsseldorf' }, | ||
| 274 | + { latLng: [51.51, 7.46], name: 'Dortmund' }, | ||
| 275 | + { latLng: [51.45, 7.01], name: 'Essen' }, | ||
| 276 | + { latLng: [53.07, 8.80], name: 'Bremen' } | ||
| 277 | + ], | ||
| 278 | + cityAreaData = [ | ||
| 279 | + 887.70, | ||
| 280 | + 755.16, | ||
| 281 | + 310.69, | ||
| 282 | + 405.17, | ||
| 283 | + 248.31, | ||
| 284 | + 207.35, | ||
| 285 | + 217.22, | ||
| 286 | + 280.71, | ||
| 287 | + 210.32, | ||
| 288 | + 325.42 | ||
| 289 | + ] | ||
| 290 | + if ($.fn.vectorMap !== undefined && $('#rusia-map').length > 0) { | ||
| 291 | + $('#rusia-map').vectorMap({ | ||
| 292 | + map: 'de_merc', | ||
| 293 | + regionsSelectable: true, | ||
| 294 | + markersSelectable: true, | ||
| 295 | + markers: markers, | ||
| 296 | + markerStyle: { | ||
| 297 | + initial: { | ||
| 298 | + fill: '#4DAC26' | ||
| 299 | + }, | ||
| 300 | + selected: { | ||
| 301 | + fill: '#CA0020' | ||
| 302 | + } | ||
| 303 | + }, | ||
| 304 | + regionStyle: { | ||
| 305 | + initial: { | ||
| 306 | + fill: '#B8E186' | ||
| 307 | + }, | ||
| 308 | + selected: { | ||
| 309 | + fill: '#F4A582' | ||
| 310 | + } | ||
| 311 | + }, | ||
| 312 | + series: { | ||
| 313 | + markers: [{ | ||
| 314 | + attribute: 'r', | ||
| 315 | + scale: [5, 15], | ||
| 316 | + values: cityAreaData | ||
| 317 | + }] | ||
| 318 | + }, | ||
| 319 | + onRegionSelected: function () { | ||
| 320 | + if (window.localStorage) { | ||
| 321 | + window.localStorage.setItem( | ||
| 322 | + 'jvectormap-selected-regions', | ||
| 323 | + JSON.stringify(map.getSelectedRegions()) | ||
| 324 | + ); | ||
| 325 | + } | ||
| 326 | + }, | ||
| 327 | + onMarkerSelected: function () { | ||
| 328 | + if (window.localStorage) { | ||
| 329 | + window.localStorage.setItem( | ||
| 330 | + 'jvectormap-selected-markers', | ||
| 331 | + JSON.stringify(map.getSelectedMarkers()) | ||
| 332 | + ); | ||
| 333 | + } | ||
| 334 | + } | ||
| 335 | + }) | ||
| 336 | + } | ||
| 337 | +}); | ||
| 338 | + | ||
| 339 | +$(function () { | ||
| 340 | + if ($.fn.vectorMap !== undefined && $('#legend-map').length > 0) { | ||
| 341 | + $('#legend-map').vectorMap({ | ||
| 342 | + map: 'us_aea', | ||
| 343 | + markers: [ | ||
| 344 | + [61.18, -149.53], | ||
| 345 | + [21.18, -157.49], | ||
| 346 | + [40.66, -73.56], | ||
| 347 | + [41.52, -87.37], | ||
| 348 | + [35.22, -80.84], | ||
| 349 | + [31.52, -87.37] | ||
| 350 | + ], | ||
| 351 | + series: { | ||
| 352 | + markers: [{ | ||
| 353 | + attribute: 'fill', | ||
| 354 | + scale: ['#C8EEFF', '#0071A4'], | ||
| 355 | + normalizeFunction: 'polynomial', | ||
| 356 | + values: [408, 512, 550, 781], | ||
| 357 | + legend: { | ||
| 358 | + vertical: true | ||
| 359 | + } | ||
| 360 | + }, { | ||
| 361 | + attribute: 'image', | ||
| 362 | + scale: { | ||
| 363 | + bank: '../assets/images/vectormap/icon-bank.png', | ||
| 364 | + factory: '../assets/images/vectormap/icon-factory.png' | ||
| 365 | + }, | ||
| 366 | + values: { | ||
| 367 | + '4': 'bank', | ||
| 368 | + '5': 'factory' | ||
| 369 | + }, | ||
| 370 | + legend: { | ||
| 371 | + horizontal: true, | ||
| 372 | + cssClass: 'jvectormap-legend-icons', | ||
| 373 | + title: 'Business type' | ||
| 374 | + } | ||
| 375 | + }], | ||
| 376 | + regions: [{ | ||
| 377 | + scale: { | ||
| 378 | + red: '#ff0000', | ||
| 379 | + green: '#00ff00' | ||
| 380 | + }, | ||
| 381 | + attribute: 'fill', | ||
| 382 | + values: { | ||
| 383 | + "US-KS": 'red', | ||
| 384 | + "US-MO": 'red', | ||
| 385 | + "US-IA": 'green', | ||
| 386 | + "US-NE": 'green' | ||
| 387 | + }, | ||
| 388 | + legend: { | ||
| 389 | + horizontal: true, | ||
| 390 | + title: 'Color' | ||
| 391 | + } | ||
| 392 | + }, { | ||
| 393 | + scale: { | ||
| 394 | + redGreen: '../assets/images/vectormap/bg-red-green.png', | ||
| 395 | + yellowBlue: '../assets/images/vectormap/bg-yellow-blue.png' | ||
| 396 | + }, | ||
| 397 | + values: { | ||
| 398 | + "US-TX": 'redGreen', | ||
| 399 | + "US-CA": 'yellowBlue' | ||
| 400 | + }, | ||
| 401 | + attribute: 'fill', | ||
| 402 | + legend: { | ||
| 403 | + horizontal: true, | ||
| 404 | + cssClass: 'jvectormap-legend-bg', | ||
| 405 | + title: 'Pattern', | ||
| 406 | + labelRender: function (v) { | ||
| 407 | + return { | ||
| 408 | + redGreen: 'low', | ||
| 409 | + yellowBlue: 'high' | ||
| 410 | + }[v]; | ||
| 411 | + } | ||
| 412 | + } | ||
| 413 | + }] | ||
| 414 | + } | ||
| 415 | + }) | ||
| 416 | + } | ||
| 417 | +}); | ||
| 418 | + | ||
| 419 | +$(function () { | ||
| 420 | + var plants = [ | ||
| 421 | + { name: 'VAK', coords: [50.0091294, 9.0371812], status: 'closed', offsets: [0, 2] }, | ||
| 422 | + { name: 'MZFR', coords: [49.0543102, 8.4825862], status: 'closed', offsets: [0, 2] }, | ||
| 423 | + { name: 'AVR', coords: [50.9030599, 6.4213693], status: 'closed' }, | ||
| 424 | + { name: 'KKR', coords: [53.1472465, 12.9903674], status: 'closed' }, | ||
| 425 | + { name: 'KRB', coords: [48.513264, 10.4020357], status: 'activeUntil2018' }, | ||
| 426 | + { name: 'KWO', coords: [49.364503, 9.076252], status: 'closed' }, | ||
| 427 | + { name: 'KWL', coords: [52.5331853, 7.2505223], status: 'closed', offsets: [0, -2] }, | ||
| 428 | + { name: 'HDR', coords: [50.1051446, 8.9348691], status: 'closed', offsets: [0, -2] }, | ||
| 429 | + { name: 'KKS', coords: [53.6200685, 9.5306289], status: 'closed' }, | ||
| 430 | + { name: 'KKN', coords: [48.6558015, 12.2500848], status: 'closed', offsets: [0, -2] }, | ||
| 431 | + { name: 'KGR', coords: [54.1417497, 13.6583877], status: 'closed' }, | ||
| 432 | + { name: 'KWB', coords: [49.709331, 8.415865], status: 'closed' }, | ||
| 433 | + { name: 'KWW', coords: [51.6396481, 9.3915617], status: 'closed' }, | ||
| 434 | + { name: 'GKN', coords: [49.0401151, 9.1721088], status: 'activeUntil2022' }, | ||
| 435 | + { name: 'KKB', coords: [53.8913533, 9.2005777], status: 'closed', offsets: [0, -5] }, | ||
| 436 | + { name: 'KKI', coords: [48.5544748, 12.3472095], status: 'activeUntil2022', offsets: [0, 2] }, | ||
| 437 | + { name: 'KKU', coords: [53.4293465, 8.4774649], status: 'closed' }, | ||
| 438 | + { name: 'KNK', coords: [49.1473279, 8.3827739], status: 'closed' }, | ||
| 439 | + { name: 'KKP', coords: [49.2513078, 8.4356761], status: 'activeUntil2022', offsets: [0, -2] }, | ||
| 440 | + { name: 'KKG', coords: [49.9841308, 10.1846373], status: 'activeUntil2018' }, | ||
| 441 | + { name: 'KKK', coords: [53.4104656, 10.4091597], status: 'closed' }, | ||
| 442 | + { name: 'KWG', coords: [52.0348748, 9.4097793], status: 'activeUntil2022' }, | ||
| 443 | + { name: 'KBR', coords: [53.850666, 9.3457603], status: 'closed', offsets: [0, 5] }, | ||
| 444 | + { name: 'KMK', coords: [50.408791, 7.4861956], status: 'closed' }, | ||
| 445 | + { name: 'THTR', coords: [51.6786228, 7.9700232], status: 'closed' }, | ||
| 446 | + { name: 'KKE', coords: [52.4216974, 7.3706389], status: 'activeUntil2022', offsets: [0, 2] } | ||
| 447 | + ]; | ||
| 448 | + if ($.fn.vectorMap !== undefined && $('#icon-map').length > 0) { | ||
| 449 | + $('#icon-map').vectorMap({ | ||
| 450 | + map: 'de_merc', | ||
| 451 | + markers: plants.map(function (h) { return { name: h.name, latLng: h.coords } }), | ||
| 452 | + labels: { | ||
| 453 | + markers: { | ||
| 454 | + render: function (index) { | ||
| 455 | + return plants[index].name; | ||
| 456 | + }, | ||
| 457 | + offsets: function (index) { | ||
| 458 | + var offset = plants[index]['offsets'] || [0, 0]; | ||
| 459 | + | ||
| 460 | + return [offset[0] - 7, offset[1] + 3]; | ||
| 461 | + } | ||
| 462 | + } | ||
| 463 | + }, | ||
| 464 | + series: { | ||
| 465 | + markers: [{ | ||
| 466 | + attribute: 'image', | ||
| 467 | + scale: { | ||
| 468 | + 'closed': '../assets/images/vectormap/icon-np-3.png', | ||
| 469 | + 'activeUntil2018': '../assets/images/vectormap/icon-np-2.png', | ||
| 470 | + 'activeUntil2022': '../assets/images/vectormap/icon-np-1.png' | ||
| 471 | + }, | ||
| 472 | + values: plants.reduce(function (p, c, i) { p[i] = c.status; return p }, {}), | ||
| 473 | + legend: { | ||
| 474 | + horizontal: true, | ||
| 475 | + title: 'Nuclear power station status', | ||
| 476 | + labelRender: function (v) { | ||
| 477 | + return { | ||
| 478 | + closed: 'Closed', | ||
| 479 | + activeUntil2018: 'Scheduled for shut down<br> before 2018', | ||
| 480 | + activeUntil2022: 'Scheduled for shut down<br> before 2022' | ||
| 481 | + }[v]; | ||
| 482 | + } | ||
| 483 | + } | ||
| 484 | + }] | ||
| 485 | + } | ||
| 486 | + }) | ||
| 487 | + } | ||
| 488 | +}); |
-
Please register or login to post a comment