Plugin Directory

Changeset 2830285


Ignore:
Timestamp:
12/07/2022 09:29:17 PM (3 years ago)
Author:
swarminteractive
Message:

Updating tag to 1.4.16

Location:
viewmedica
Files:
5 edited
2 copied

Legend:

Unmodified
Added
Removed
  • viewmedica/tags/1.4.16/readme.txt

    r2830204 r2830285  
    66Tested up to: 6.1.1
    77Requires PHP: 5.2.4
    8 Stable tag: 1.4.15
     8Stable tag: 1.4.16
    99License: GPLv2 or later
    1010License URI: http://www.gnu.org/licenses/gpl-2.0.html
  • viewmedica/tags/1.4.16/swarm.php

    r2654627 r2830285  
    300300add_action('plugins_loaded', 'swarm_install');
    301301
     302function thickbox()
     303{
     304    add_thickbox();
     305}
     306
     307add_action('admin_enqueue_scripts', 'thickbox');
     308
     309
    302310register_activation_hook(__FILE__, 'swarm_install');
    303311
  • viewmedica/tags/1.4.16/swarm_plugin.js

    r2654627 r2830285  
    6565                <tr>\
    6666                    <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>\
    6969                </tr>\
    7070                <tr>\
     
    7979                </tr>\
    8080                <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>\
    8681                    <th><label for="viewmedica-captions">Hide Captions Button</label></th>\
    8782                    <td><input type="checkbox" id="viewmedica_captions" name="captions" value="false" /><br />\
     
    9085                <tr>\
    9186                    <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 />\
    9388                    <small>Subtitles are shown by default when a video is playing</small></td>\
    9489                </tr>\
     
    116111        jQuery.ajax({
    117112            dataType: "json",
    118             url: 'https://swarminteractive.com/vm/index/client_json/' + vm_client,
     113            url: 'https://api.viewmedica.com/wordpress/users/' + vm_client + '/profile',
    119114            success: function(data) {
    120115                build(data, form);
     
    130125                    'width': '',
    131126                    'audio': '',
    132                     'autoplay': '',
    133127                    'captions': '',
    134128                    'subtitles': '',
    135129                    'markup': '',
    136130                    'sections': '',
    137                     'sharing': ''
     131                    'sharing': '',
     132                    'menuaccess': ''
    138133                };
    139134                var shortcode = '[viewmedica';
     
    143138                    if (table.find('#viewmedica_'+index).is(':checkbox')) {
    144139                      // 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                      }
    147143                   } else {
    148144                     // attaches the attribute to the shortcode only if it's different from the default value
    149145                     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                       
    151152                     }
    152                 }
    153 
    154                 if( table.find('#viewmedica_menuaccess').attr('checked') == 'checked' ) {
    155                     shortcode += ' menuaccess="false"';
    156153                }
    157154
     
    169166}
    170167
    171 function build(profile, form)
    172 {
     168function 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
     183function build(profile, form) {
    173184    var html = '<select id="vm-open" style="width: 100%"><option value="">Main Embed</option>\
    174185                    ';
    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    });
    200189
    201190    html+= '</select>';
    202191
    203     form.find('#open-selector').html(html);
     192    document.querySelector("#open-selector").innerHTML = html;
    204193
    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    })
    209197}
  • viewmedica/trunk/readme.txt

    r2830204 r2830285  
    66Tested up to: 6.1.1
    77Requires PHP: 5.2.4
    8 Stable tag: 1.4.15
     8Stable tag: 1.4.16
    99License: GPLv2 or later
    1010License URI: http://www.gnu.org/licenses/gpl-2.0.html
  • viewmedica/trunk/swarm.php

    r2654627 r2830285  
    300300add_action('plugins_loaded', 'swarm_install');
    301301
     302function thickbox()
     303{
     304    add_thickbox();
     305}
     306
     307add_action('admin_enqueue_scripts', 'thickbox');
     308
     309
    302310register_activation_hook(__FILE__, 'swarm_install');
    303311
  • viewmedica/trunk/swarm_plugin.js

    r2654627 r2830285  
    6565                <tr>\
    6666                    <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>\
    6969                </tr>\
    7070                <tr>\
     
    7979                </tr>\
    8080                <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>\
    8681                    <th><label for="viewmedica-captions">Hide Captions Button</label></th>\
    8782                    <td><input type="checkbox" id="viewmedica_captions" name="captions" value="false" /><br />\
     
    9085                <tr>\
    9186                    <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 />\
    9388                    <small>Subtitles are shown by default when a video is playing</small></td>\
    9489                </tr>\
     
    116111        jQuery.ajax({
    117112            dataType: "json",
    118             url: 'https://swarminteractive.com/vm/index/client_json/' + vm_client,
     113            url: 'https://api.viewmedica.com/wordpress/users/' + vm_client + '/profile',
    119114            success: function(data) {
    120115                build(data, form);
     
    130125                    'width': '',
    131126                    'audio': '',
    132                     'autoplay': '',
    133127                    'captions': '',
    134128                    'subtitles': '',
    135129                    'markup': '',
    136130                    'sections': '',
    137                     'sharing': ''
     131                    'sharing': '',
     132                    'menuaccess': ''
    138133                };
    139134                var shortcode = '[viewmedica';
     
    143138                    if (table.find('#viewmedica_'+index).is(':checkbox')) {
    144139                      // 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                      }
    147143                   } else {
    148144                     // attaches the attribute to the shortcode only if it's different from the default value
    149145                     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                       
    151152                     }
    152                 }
    153 
    154                 if( table.find('#viewmedica_menuaccess').attr('checked') == 'checked' ) {
    155                     shortcode += ' menuaccess="false"';
    156153                }
    157154
     
    169166}
    170167
    171 function build(profile, form)
    172 {
     168function 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
     183function build(profile, form) {
    173184    var html = '<select id="vm-open" style="width: 100%"><option value="">Main Embed</option>\
    174185                    ';
    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    });
    200189
    201190    html+= '</select>';
    202191
    203     form.find('#open-selector').html(html);
     192    document.querySelector("#open-selector").innerHTML = html;
    204193
    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    })
    209197}
Note: See TracChangeset for help on using the changeset viewer.