1 | (function($) { |
||
0 ignored issues
–
show
Coding Style
introduced
by
![]() |
|||
2 | |||
3 | var entityMap = { |
||
4 | '&': '&', |
||
0 ignored issues
–
show
|
|||
5 | '<': '<', |
||
0 ignored issues
–
show
|
|||
6 | '>': '>', |
||
0 ignored issues
–
show
|
|||
7 | '"': '"', |
||
0 ignored issues
–
show
|
|||
8 | "'": ''', |
||
0 ignored issues
–
show
|
|||
9 | '/': '/', |
||
0 ignored issues
–
show
|
|||
10 | '`': '`', |
||
0 ignored issues
–
show
|
|||
11 | '=': '=' |
||
0 ignored issues
–
show
|
|||
12 | }; |
||
13 | |||
14 | function escapeHtml(string) { |
||
15 | return String(string).replace(/[&<>"'`=\/]/g, function (s) { |
||
0 ignored issues
–
show
|
|||
16 | return entityMap[s]; |
||
0 ignored issues
–
show
|
|||
17 | }); |
||
0 ignored issues
–
show
For multi-line function calls, the closing parenthesis should be on a new line.
If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line: someFunctionCall(
$firstArgument,
$secondArgument,
$thirdArgument
); // Closing parenthesis on a new line.
![]() |
|||
18 | } |
||
19 | |||
20 | function podlove_init_color_buttons() { |
||
21 | jQuery(document).ready( function($) { |
||
0 ignored issues
–
show
|
|||
22 | var params = { |
||
23 | change: function(e, ui) { |
||
24 | $( e.target ).val( ui.color.toString() ); |
||
25 | $( e.target ).trigger('change'); // enable widget "Save" button |
||
0 ignored issues
–
show
|
|||
26 | }, |
||
27 | } |
||
28 | |||
29 | $('.podlove_subscribe_button_color').not('[id*="__i__"]').wpColorPicker( params ); |
||
0 ignored issues
–
show
|
|||
30 | }) |
||
0 ignored issues
–
show
For multi-line function calls, the closing parenthesis should be on a new line.
If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line: someFunctionCall(
$firstArgument,
$secondArgument,
$thirdArgument
); // Closing parenthesis on a new line.
![]() |
|||
31 | } |
||
32 | |||
33 | $( document ).ready( function() { |
||
0 ignored issues
–
show
|
|||
34 | |||
35 | $("#Podlove_cover_image_select").on( 'click', function(event) { |
||
0 ignored issues
–
show
|
|||
36 | podlove_cover_image_selector = wp.media.frames.customHeader = wp.media( { |
||
0 ignored issues
–
show
The variable
wp seems to be never declared. If this is a global, consider adding a /** global: wp */ comment.
This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed. To learn more about declaring variables in Javascript, see the MDN. ![]() |
|||
37 | title: i18n.media_library, |
||
0 ignored issues
–
show
The variable
i18n seems to be never declared. If this is a global, consider adding a /** global: i18n */ comment.
This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed. To learn more about declaring variables in Javascript, see the MDN. ![]() |
|||
38 | library: { |
||
39 | type: 'image' |
||
40 | }, |
||
41 | button: { |
||
42 | text: i18n.use_for |
||
43 | }, |
||
44 | multiple: false |
||
45 | } ); |
||
0 ignored issues
–
show
For multi-line function calls, the closing parenthesis should be on a new line.
If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line: someFunctionCall(
$firstArgument,
$secondArgument,
$thirdArgument
); // Closing parenthesis on a new line.
![]() |
|||
46 | podlove_cover_image_selector.open(); |
||
47 | |||
48 | podlove_cover_image_selector.on('select', function() { |
||
0 ignored issues
–
show
|
|||
49 | var podcast_image_url = podlove_cover_image_selector.state().get('selection').first().toJSON().url; |
||
0 ignored issues
–
show
|
|||
50 | $("#podlove-button-cover").val(podcast_image_url); |
||
0 ignored issues
–
show
|
|||
51 | $("#podlove-button-cover").trigger('change'); |
||
0 ignored issues
–
show
|
|||
52 | }); |
||
0 ignored issues
–
show
For multi-line function calls, the closing parenthesis should be on a new line.
If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line: someFunctionCall(
$firstArgument,
$secondArgument,
$thirdArgument
); // Closing parenthesis on a new line.
![]() |
|||
53 | } ); |
||
0 ignored issues
–
show
For multi-line function calls, the closing parenthesis should be on a new line.
If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line: someFunctionCall(
$firstArgument,
$secondArgument,
$thirdArgument
); // Closing parenthesis on a new line.
![]() |
|||
54 | |||
55 | $(document).ready(function () { |
||
0 ignored issues
–
show
|
|||
56 | podlove_init_color_buttons(); |
||
57 | |||
58 | jQuery(document).on('widget-updated', podlove_init_color_buttons); |
||
0 ignored issues
–
show
|
|||
59 | jQuery(document).on('widget-added', podlove_init_color_buttons); |
||
0 ignored issues
–
show
|
|||
60 | |||
61 | // re-init after saving configs |
||
0 ignored issues
–
show
|
|||
62 | jQuery(document).on('ajaxComplete', function(e){ |
||
0 ignored issues
–
show
|
|||
63 | podlove_init_color_buttons(); |
||
64 | }); |
||
0 ignored issues
–
show
For multi-line function calls, the closing parenthesis should be on a new line.
If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line: someFunctionCall(
$firstArgument,
$secondArgument,
$thirdArgument
); // Closing parenthesis on a new line.
![]() |
|||
65 | }) |
||
0 ignored issues
–
show
For multi-line function calls, the closing parenthesis should be on a new line.
If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line: someFunctionCall(
$firstArgument,
$secondArgument,
$thirdArgument
); // Closing parenthesis on a new line.
![]() |
|||
66 | |||
67 | var feed_counter = 0; |
||
68 | var source = $("#feed_line_template").html(); |
||
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 7 spaces but found 1 space
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. ![]() |
|||
69 | |||
70 | $(".add_feed").on( 'click', function () { |
||
0 ignored issues
–
show
|
|||
71 | add_new_feed(); |
||
72 | } ); |
||
0 ignored issues
–
show
For multi-line function calls, the closing parenthesis should be on a new line.
If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line: someFunctionCall(
$firstArgument,
$secondArgument,
$thirdArgument
); // Closing parenthesis on a new line.
![]() |
|||
73 | |||
74 | if ( window.feeds !== undefined ) { |
||
75 | $.each( feeds, function (index, feed) { |
||
0 ignored issues
–
show
The variable
feeds seems to be never declared. If this is a global, consider adding a /** global: feeds */ comment.
This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed. To learn more about declaring variables in Javascript, see the MDN. ![]() |
|||
76 | add_existing_feed(feed); |
||
0 ignored issues
–
show
|
|||
77 | } ); |
||
0 ignored issues
–
show
For multi-line function calls, the closing parenthesis should be on a new line.
If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line: someFunctionCall(
$firstArgument,
$secondArgument,
$thirdArgument
); // Closing parenthesis on a new line.
![]() |
|||
78 | } |
||
79 | |||
80 | function add_new_feed() { |
||
81 | row = source.replace( /\{\{url\}\}/g, '' ); |
||
0 ignored issues
–
show
|
|||
82 | row = row.replace( /\{\{itunesfeedid\}\}/g, '' ); |
||
83 | row = row.replace( /\{\{id\}\}/g, feed_counter ); |
||
84 | |||
85 | $("#feeds_table_body").append(row); |
||
0 ignored issues
–
show
|
|||
86 | |||
87 | new_row = $("#feeds_table_body tr:last"); |
||
0 ignored issues
–
show
|
|||
88 | new_row.find("input:first").focus(); |
||
0 ignored issues
–
show
|
|||
89 | |||
90 | $(".podlove-icon-remove").on( 'click', function () { |
||
0 ignored issues
–
show
|
|||
91 | $(this).closest("tr").remove(); |
||
0 ignored issues
–
show
|
|||
92 | } ); |
||
0 ignored issues
–
show
For multi-line function calls, the closing parenthesis should be on a new line.
If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line: someFunctionCall(
$firstArgument,
$secondArgument,
$thirdArgument
); // Closing parenthesis on a new line.
![]() |
|||
93 | |||
94 | feed_counter++; |
||
95 | } |
||
96 | |||
97 | function add_existing_feed( feed ) { |
||
98 | row = source.replace( /\{\{url\}\}/g, escapeHtml(feed.url) ); |
||
0 ignored issues
–
show
|
|||
99 | row = row.replace( /\{\{id\}\}/g, feed_counter ); |
||
100 | if ( feed.itunesfeedid == null ) { |
||
0 ignored issues
–
show
|
|||
101 | row = row.replace( /\{\{itunesfeedid\}\}/g, '' ); |
||
102 | } else { |
||
103 | row = row.replace( /\{\{itunesfeedid\}\}/g, escapeHtml(feed.itunesfeedid) ); |
||
0 ignored issues
–
show
|
|||
104 | } |
||
105 | |||
106 | $("#feeds_table_body").append(row); |
||
0 ignored issues
–
show
|
|||
107 | |||
108 | new_row = $("#feeds_table_body tr:last"); |
||
0 ignored issues
–
show
|
|||
109 | new_row.find('select.podlove-media-format option[value="' + escapeHtml(feed.format) + '"]').attr('selected',true); |
||
0 ignored issues
–
show
|
|||
110 | |||
111 | $(".podlove-icon-remove").on( 'click', function () { |
||
0 ignored issues
–
show
|
|||
112 | $(this).closest("tr").remove(); |
||
0 ignored issues
–
show
|
|||
113 | } ); |
||
0 ignored issues
–
show
For multi-line function calls, the closing parenthesis should be on a new line.
If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line: someFunctionCall(
$firstArgument,
$secondArgument,
$thirdArgument
); // Closing parenthesis on a new line.
![]() |
|||
114 | |||
115 | feed_counter++; |
||
116 | } |
||
117 | |||
118 | } ); |
||
0 ignored issues
–
show
For multi-line function calls, the closing parenthesis should be on a new line.
If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line: someFunctionCall(
$firstArgument,
$secondArgument,
$thirdArgument
); // Closing parenthesis on a new line.
![]() |
|||
119 | }(jQuery)); |