Changeset 2830285
- Timestamp:
- 12/07/2022 09:29:17 PM (3 years ago)
- Location:
- viewmedica
- Files:
-
- 5 edited
- 2 copied
-
tags/1.4.16 (copied) (copied from viewmedica/trunk)
-
tags/1.4.16/readme.txt (copied) (copied from viewmedica/trunk/readme.txt) (1 diff)
-
tags/1.4.16/swarm.php (modified) (1 diff)
-
tags/1.4.16/swarm_plugin.js (modified) (7 diffs)
-
trunk/readme.txt (modified) (1 diff)
-
trunk/swarm.php (modified) (1 diff)
-
trunk/swarm_plugin.js (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
viewmedica/tags/1.4.16/readme.txt
r2830204 r2830285 6 6 Tested up to: 6.1.1 7 7 Requires PHP: 5.2.4 8 Stable tag: 1.4.1 58 Stable tag: 1.4.16 9 9 License: GPLv2 or later 10 10 License URI: http://www.gnu.org/licenses/gpl-2.0.html -
viewmedica/tags/1.4.16/swarm.php
r2654627 r2830285 300 300 add_action('plugins_loaded', 'swarm_install'); 301 301 302 function thickbox() 303 { 304 add_thickbox(); 305 } 306 307 add_action('admin_enqueue_scripts', 'thickbox'); 308 309 302 310 register_activation_hook(__FILE__, 'swarm_install'); 303 311 -
viewmedica/tags/1.4.16/swarm_plugin.js
r2654627 r2830285 65 65 <tr>\ 66 66 <th><label for="viewmedica-width">Player Width</label></th>\ 67 <td><input type="text" id="viewmedica_width" name="width" value="" /> <br />\68 <small>Set a maximum width for the ViewMedica content . Leave blank for default set on options page.</small></td>\67 <td><input type="text" id="viewmedica_width" name="width" value="" />px<br />\ 68 <small>Set a maximum width for the ViewMedica content in pixels. Leave blank for default set on options page.</small></td>\ 69 69 </tr>\ 70 70 <tr>\ … … 79 79 </tr>\ 80 80 <tr>\ 81 <th><label for="viewmedica-autoplay">Autoplay Video</label></th>\82 <td><input type="checkbox" id="viewmedica_autoplay" name="autoplay" value="true" /><br />\83 <small>Attempt to autoplay the video (does not work on mobile)</small></td>\84 </tr>\85 <tr>\86 81 <th><label for="viewmedica-captions">Hide Captions Button</label></th>\ 87 82 <td><input type="checkbox" id="viewmedica_captions" name="captions" value="false" /><br />\ … … 90 85 <tr>\ 91 86 <th><label for="viewmedica-subtitles">Show Subtitles</label></th>\ 92 <td><input type="checkbox" id="viewmedica_subtitles" name="subtitles" value=" false" /><br />\87 <td><input type="checkbox" id="viewmedica_subtitles" name="subtitles" value="true" /><br />\ 93 88 <small>Subtitles are shown by default when a video is playing</small></td>\ 94 89 </tr>\ … … 116 111 jQuery.ajax({ 117 112 dataType: "json", 118 url: 'https:// swarminteractive.com/vm/index/client_json/' + vm_client,113 url: 'https://api.viewmedica.com/wordpress/users/' + vm_client + '/profile', 119 114 success: function(data) { 120 115 build(data, form); … … 130 125 'width': '', 131 126 'audio': '', 132 'autoplay': '',133 127 'captions': '', 134 128 'subtitles': '', 135 129 'markup': '', 136 130 'sections': '', 137 'sharing': '' 131 'sharing': '', 132 'menuaccess': '' 138 133 }; 139 134 var shortcode = '[viewmedica'; … … 143 138 if (table.find('#viewmedica_'+index).is(':checkbox')) { 144 139 // attaches the attribute to the shortcode only if it's different from the default value 145 if ( table.find('#viewmedica_'+index).is(':checked') && value != '' ) 146 shortcode += ' ' + index + '="' + value + '"'; 140 if ( table.find('#viewmedica_'+index).is(':checked') && value != '' ) { 141 shortcode += ' ' + index + '="' + value + '"'; 142 } 147 143 } else { 148 144 // attaches the attribute to the shortcode only if it's different from the default value 149 145 if ( value !== options[index] && value != '' ) 150 shortcode += ' ' + index + '="' + value + '"'; 146 if (index === 'width') { 147 shortcode += ' ' + index + '="' + parseInt(value) + '"'; 148 } else { 149 shortcode += ' ' + index + '="' + value + '"'; 150 } 151 151 152 } 152 }153 154 if( table.find('#viewmedica_menuaccess').attr('checked') == 'checked' ) {155 shortcode += ' menuaccess="false"';156 153 } 157 154 … … 169 166 } 170 167 171 function build(profile, form) 172 { 168 function handleItem(item, level) { 169 if (!item.children) { 170 return `<option value="${item.code}">${"--".repeat(level)} ${item.labels.en}</option>`; 171 } 172 173 var children = ""; 174 175 item.children.forEach((child) => { 176 children += handleItem(child, level + 1); 177 }); 178 179 return `<option value="${item.code}">${"--".repeat(level)} ${item.labels.en}</option>` + children; 180 181 } 182 183 function build(profile, form) { 173 184 var html = '<select id="vm-open" style="width: 100%"><option value="">Main Embed</option>\ 174 185 '; 175 176 for (var lib_key in profile.libraries) { 177 178 var l = profile.libraries[lib_key]; 179 html += '<option value="' + lib_key + '">' + l.label + '</option>'; 180 181 for (var col_key in profile.libraries[lib_key].collections) { 182 183 var c = profile.libraries[lib_key].collections[col_key]; 184 html += '<option value="' + col_key + '">-- ' + c.label + '</option>'; 185 186 for (var grp_key in profile.libraries[lib_key].collections[col_key].groups) { 187 188 var g = profile.libraries[lib_key].collections[col_key].groups[grp_key]; 189 html += '<option value="' + grp_key + '">---- ' + g.label + '</option>'; 190 191 for (var item_key in profile.libraries[lib_key].collections[col_key].groups[grp_key].items) { 192 var r = profile.libraries[lib_key].collections[col_key].groups[grp_key].items[item_key]; 193 var label = r.label.replace('|', ""); 194 html += '<option value="' + item_key + '">------ ' + label + '</option>'; 195 } 196 197 } 198 } 199 } 186 profile.forEach((item) => { 187 html += handleItem(item, 1); 188 }); 200 189 201 190 html+= '</select>'; 202 191 203 form.find('#open-selector').html(html);192 document.querySelector("#open-selector").innerHTML = html; 204 193 205 form.find('#vm-open').change(function() { 206 jQuery('#viewmedica_openthis').val( jQuery(this).val() ); 207 }); 208 194 document.querySelector("#vm-open").addEventListener("change", function(e) { 195 document.querySelector("#viewmedica_openthis").value = e.target.value; 196 }) 209 197 } -
viewmedica/trunk/readme.txt
r2830204 r2830285 6 6 Tested up to: 6.1.1 7 7 Requires PHP: 5.2.4 8 Stable tag: 1.4.1 58 Stable tag: 1.4.16 9 9 License: GPLv2 or later 10 10 License URI: http://www.gnu.org/licenses/gpl-2.0.html -
viewmedica/trunk/swarm.php
r2654627 r2830285 300 300 add_action('plugins_loaded', 'swarm_install'); 301 301 302 function thickbox() 303 { 304 add_thickbox(); 305 } 306 307 add_action('admin_enqueue_scripts', 'thickbox'); 308 309 302 310 register_activation_hook(__FILE__, 'swarm_install'); 303 311 -
viewmedica/trunk/swarm_plugin.js
r2654627 r2830285 65 65 <tr>\ 66 66 <th><label for="viewmedica-width">Player Width</label></th>\ 67 <td><input type="text" id="viewmedica_width" name="width" value="" /> <br />\68 <small>Set a maximum width for the ViewMedica content . Leave blank for default set on options page.</small></td>\67 <td><input type="text" id="viewmedica_width" name="width" value="" />px<br />\ 68 <small>Set a maximum width for the ViewMedica content in pixels. Leave blank for default set on options page.</small></td>\ 69 69 </tr>\ 70 70 <tr>\ … … 79 79 </tr>\ 80 80 <tr>\ 81 <th><label for="viewmedica-autoplay">Autoplay Video</label></th>\82 <td><input type="checkbox" id="viewmedica_autoplay" name="autoplay" value="true" /><br />\83 <small>Attempt to autoplay the video (does not work on mobile)</small></td>\84 </tr>\85 <tr>\86 81 <th><label for="viewmedica-captions">Hide Captions Button</label></th>\ 87 82 <td><input type="checkbox" id="viewmedica_captions" name="captions" value="false" /><br />\ … … 90 85 <tr>\ 91 86 <th><label for="viewmedica-subtitles">Show Subtitles</label></th>\ 92 <td><input type="checkbox" id="viewmedica_subtitles" name="subtitles" value=" false" /><br />\87 <td><input type="checkbox" id="viewmedica_subtitles" name="subtitles" value="true" /><br />\ 93 88 <small>Subtitles are shown by default when a video is playing</small></td>\ 94 89 </tr>\ … … 116 111 jQuery.ajax({ 117 112 dataType: "json", 118 url: 'https:// swarminteractive.com/vm/index/client_json/' + vm_client,113 url: 'https://api.viewmedica.com/wordpress/users/' + vm_client + '/profile', 119 114 success: function(data) { 120 115 build(data, form); … … 130 125 'width': '', 131 126 'audio': '', 132 'autoplay': '',133 127 'captions': '', 134 128 'subtitles': '', 135 129 'markup': '', 136 130 'sections': '', 137 'sharing': '' 131 'sharing': '', 132 'menuaccess': '' 138 133 }; 139 134 var shortcode = '[viewmedica'; … … 143 138 if (table.find('#viewmedica_'+index).is(':checkbox')) { 144 139 // attaches the attribute to the shortcode only if it's different from the default value 145 if ( table.find('#viewmedica_'+index).is(':checked') && value != '' ) 146 shortcode += ' ' + index + '="' + value + '"'; 140 if ( table.find('#viewmedica_'+index).is(':checked') && value != '' ) { 141 shortcode += ' ' + index + '="' + value + '"'; 142 } 147 143 } else { 148 144 // attaches the attribute to the shortcode only if it's different from the default value 149 145 if ( value !== options[index] && value != '' ) 150 shortcode += ' ' + index + '="' + value + '"'; 146 if (index === 'width') { 147 shortcode += ' ' + index + '="' + parseInt(value) + '"'; 148 } else { 149 shortcode += ' ' + index + '="' + value + '"'; 150 } 151 151 152 } 152 }153 154 if( table.find('#viewmedica_menuaccess').attr('checked') == 'checked' ) {155 shortcode += ' menuaccess="false"';156 153 } 157 154 … … 169 166 } 170 167 171 function build(profile, form) 172 { 168 function handleItem(item, level) { 169 if (!item.children) { 170 return `<option value="${item.code}">${"--".repeat(level)} ${item.labels.en}</option>`; 171 } 172 173 var children = ""; 174 175 item.children.forEach((child) => { 176 children += handleItem(child, level + 1); 177 }); 178 179 return `<option value="${item.code}">${"--".repeat(level)} ${item.labels.en}</option>` + children; 180 181 } 182 183 function build(profile, form) { 173 184 var html = '<select id="vm-open" style="width: 100%"><option value="">Main Embed</option>\ 174 185 '; 175 176 for (var lib_key in profile.libraries) { 177 178 var l = profile.libraries[lib_key]; 179 html += '<option value="' + lib_key + '">' + l.label + '</option>'; 180 181 for (var col_key in profile.libraries[lib_key].collections) { 182 183 var c = profile.libraries[lib_key].collections[col_key]; 184 html += '<option value="' + col_key + '">-- ' + c.label + '</option>'; 185 186 for (var grp_key in profile.libraries[lib_key].collections[col_key].groups) { 187 188 var g = profile.libraries[lib_key].collections[col_key].groups[grp_key]; 189 html += '<option value="' + grp_key + '">---- ' + g.label + '</option>'; 190 191 for (var item_key in profile.libraries[lib_key].collections[col_key].groups[grp_key].items) { 192 var r = profile.libraries[lib_key].collections[col_key].groups[grp_key].items[item_key]; 193 var label = r.label.replace('|', ""); 194 html += '<option value="' + item_key + '">------ ' + label + '</option>'; 195 } 196 197 } 198 } 199 } 186 profile.forEach((item) => { 187 html += handleItem(item, 1); 188 }); 200 189 201 190 html+= '</select>'; 202 191 203 form.find('#open-selector').html(html);192 document.querySelector("#open-selector").innerHTML = html; 204 193 205 form.find('#vm-open').change(function() { 206 jQuery('#viewmedica_openthis').val( jQuery(this).val() ); 207 }); 208 194 document.querySelector("#vm-open").addEventListener("change", function(e) { 195 document.querySelector("#viewmedica_openthis").value = e.target.value; 196 }) 209 197 }
Note: See TracChangeset
for help on using the changeset viewer.