PluginProbe ʕ •ᴥ•ʔ
WP Popular Posts / 3.2.2
WP Popular Posts v3.2.2
4.0.8 4.0.9 4.1.0 4.1.1 4.1.2 4.2.0 4.2.1 4.2.2 5.0.0 5.0.1 5.0.2 5.1.0 5.2.0 5.2.1 5.2.2 5.2.3 5.2.4 5.3.0 5.3.1 5.3.2 5.3.3 5.3.4 5.3.5 5.3.6 5.4.0 5.4.1 5.4.2 5.5.0 5.5.1 6.0.0 6.0.1 6.0.2 6.0.3 6.0.4 6.0.5 6.1.0 6.1.1 6.1.2 6.1.3 6.1.4 6.2.0 6.2.1 6.3.0 6.3.1 6.3.2 6.3.3 6.3.4 6.4.0 6.4.1 6.4.2 7.0.0 7.0.1 7.1.0 7.2.0 7.3.0 7.3.1 7.3.2 7.3.3 7.3.4 7.3.5 7.3.6 7.3.7 7.3.8 7.4.0 trunk 2.3.7 3.0.0 3.0.1 3.0.2 3.0.3 3.1.0 3.1.1 3.2.0 3.2.1 3.2.2 3.2.3 3.3.0 3.3.1 3.3.2 3.3.3 3.3.4 4.0.0 4.0.1 4.0.10 4.0.11 4.0.12 4.0.13 4.0.2 4.0.3 4.0.5 4.0.6
wordpress-popular-posts / js / admin.js
wordpress-popular-posts / js Last commit date
admin.js 11 years ago index.php 11 years ago
admin.js
103 lines
1 (function ($) {
2 "use strict";
3 $(function () {
4
5 // STATISTICS TABS
6 $("#wpp-stats-tabs a").click(function(e){
7 var activeTab = $(this).attr("rel");
8 $(this).removeClass("button-secondary").addClass("button-primary").siblings().removeClass("button-primary").addClass("button-secondary");
9 $(".wpp-stats:visible").hide("fast", function(){
10 $("#"+activeTab).slideDown("fast");
11 });
12
13 e.preventDefault();
14 });
15
16 $(".wpp-stats").each(function(){
17 if ($("li", this).length == 1) {
18 $("li", this).addClass("wpp-stats-last-item");
19 } else {
20 $("li:last", this).addClass("wpp-stats-last-item");
21 }
22 });
23
24 // TOOLS
25 // thumb source selection
26 $("#thumb_source").change(function() {
27 if ($(this).val() == "custom_field") {
28 $("#lbl_field, #thumb_field, #row_custom_field, #row_custom_field_resize").show();
29 } else {
30 $("#lbl_field, #thumb_field, #row_custom_field, #row_custom_field_resize").hide();
31 }
32 });
33 // file upload
34 $('#upload_thumb_button').click(function(e) {
35 tb_show('Upload a thumbnail', 'media-upload.php?referer=wpp_admin&type=image&TB_iframe=true&post_id=0', false);
36 e.preventDefault();
37 });
38 window.send_to_editor = function(html) {
39 var regex = /<img[^>]+src="(http:\/\/[^">]+)"/g;
40 var result = regex.exec(html);
41
42 if ( null != result ) {
43 $('#upload_thumb_src').val(result[1]);
44
45 var img = new Image();
46 img.onload = function() {
47 $("#thumb-review").html( this ).parent().fadeIn();
48 }
49 img.src = result[1];
50 }
51
52 tb_remove();
53 };
54 // cache interval
55 $("#cache").change(function() {
56 if ($(this).val() == 1) {
57 $("#cache_refresh_interval").show();
58 } else {
59 $("#cache_refresh_interval, #cache_too_long").hide();
60 }
61 });
62 // interval
63 $("#cache_interval_time").change(function() {
64 var value = parseInt( $("#cache_interval_value").val() );
65 var time = $(this).val();
66
67 console.log(time + " " + value);
68
69 if ( time == "hour" && value > 72 ) {
70 $("#cache_too_long").show();
71 } else if ( time == "day" && value > 3 ) {
72 $("#cache_too_long").show();
73 } else if ( time == "week" && value > 1 ) {
74 $("#cache_too_long").show();
75 } else if ( time == "month" && value >= 1 ) {
76 $("#cache_too_long").show();
77 } else if ( time == "year" && value >= 1 ) {
78 $("#cache_too_long").show();
79 } else {
80 $("#cache_too_long").hide();
81 }
82 });
83
84 $("#cache_interval_value").change(function() {
85 var value = parseInt( $(this).val() );
86 var time = $("#cache_interval_time").val();
87
88 if ( time == "hour" && value > 72 ) {
89 $("#cache_too_long").show();
90 } else if ( time == "day" && value > 3 ) {
91 $("#cache_too_long").show();
92 } else if ( time == "week" && value > 1 ) {
93 $("#cache_too_long").show();
94 } else if ( time == "month" && value >= 1 ) {
95 $("#cache_too_long").show();
96 } else if ( time == "year" && value >= 1 ) {
97 $("#cache_too_long").show();
98 } else {
99 $("#cache_too_long").hide();
100 }
101 });
102 });
103 }(jQuery));