Plugin Directory

Changeset 1737861


Ignore:
Timestamp:
09/28/2017 04:27:49 PM (9 years ago)
Author:
synqfm
Message:

2.1.0 - More responsive SYNQ page in posts

Location:
synq-video
Files:
1 added
5 edited

Legend:

Unmodified
Added
Removed
  • synq-video/trunk/README.md

    r1733612 r1737861  
    6767Tested up to: 4.8.1
    6868Requires PHP: 5.4
    69 Stable tag: 2.0.1
     69Stable tag: 2.1.0
    7070License: MIT
    7171License URI: https://opensource.org/licenses/MIT
    7272
    7373## Changelog
     74
     75### 2.1.0
     76* My Uploads page and posts video selection/uploading have been made more responsive.
     77
    7478### 2.0.1
    7579* Bugfix regarding the plugin's behaviour on the post editor page.
  • synq-video/trunk/assets/js/synq-video.js

    r1733269 r1737861  
    2525    }
    2626  }, false);
     27  afterUploadsLoaded = function(){
     28    $(".search-result-img-holder").each(function(i,e){
     29      var videoId = this.dataset.videoId;
     30      var link = "https://player.synq.fm/embed/" + videoId;
     31      this.onclick = function(){
     32        window.open(link);
     33      }
     34    });
    2735
    28   $(".search-result-img-holder").each(function(i,e){
    29     var videoId = this.dataset.videoId;
    30     var link = "https://player.synq.fm/embed/" + videoId;
    31     this.onclick = function(){
    32       window.open(link);
    33     }
    34   });
     36    $('.clip-btn').click(function(e) {
     37      $(this).addClass("tooltipped");
     38      $(this).addClass("tooltipped-n");
     39      $(this).addClass("tooltipped-no-delay");
     40    });
    3541
    36   $('.clip-btn').click(function(e) {
    37     $(this).addClass("tooltipped");
    38     $(this).addClass("tooltipped-n");
    39     $(this).addClass("tooltipped-no-delay");
    40   });
     42    $('.clip-btn').mouseleave(function(e) {
     43      $(this).removeClass("tooltipped");
     44      $(this).removeClass("tooltipped-n");
     45      $(this).removeClass("tooltipped-no-delay");
     46    });
    4147
    42   $('.clip-btn').mouseleave(function(e) {
    43     $(this).removeClass("tooltipped");
    44     $(this).removeClass("tooltipped-n");
    45     $(this).removeClass("tooltipped-no-delay");
    46   });
    47 
    48   new Clipboard('.clip-btn');
     48    new Clipboard('.clip-btn');
     49  }
    4950
    5051  $('.synq-content-block a[data-toggle="tab"]').on('shown.bs.tab', function(){
  • synq-video/trunk/readme.txt

    r1733612 r1737861  
    66Tested up to: 4.8.1
    77Requires PHP: 5.4
    8 Stable tag: 2.0.1
     8Stable tag: 2.1.0
    99License: MIT
    1010License URI: https://opensource.org/licenses/MIT
     
    8282
    8383== Changelog ==
     84= 2.1.0 =
     85* My Uploads page and posts video selection/uploading have been made more responsive.
    8486= 2.0.1 =
    8587* Bugfix regarding the plugin's behaviour on the post editor page.
  • synq-video/trunk/synq-video-front.js

    r1733269 r1737861  
    66    // Get all the divs that are generated by the shortcode
    77    // Insert responsive iframes for each of them
    8     console.log('whaddup');
    98    $('.synq-video-wrapper').each((index, ele) => {
    10       console.log('whaddup, inni');
    119      var id = ele.getAttribute('id');
    1210      var url = 'https://player.synq.fm/embed/' + ele.dataset.videoId;
  • synq-video/trunk/synq-video.php

    r1733612 r1737861  
    77 * Plugin Name: SYNQ Video
    88 * Description: SYNQ Video, the best way to add video uploading and embedding to your WordPress site!
    9  * Version: 2.0.1
     9 * Version: 2.1.0
    1010 * Author: SYNQ
    1111 * Contributors: synqfm
     
    9595
    9696
    97 /* Function that gets and prints all uploaded videos */
    98 function print_my_uploads() {
     97/* AJAX page that gets and prints all uploaded videos */
     98add_action("wp_ajax_uploadspage", "uploadspage");
     99function uploadspage(){
     100
     101  /* Page that gets and prints all uploaded videos */
    99102  if (get_option('synq_api_key'))
    100103  {
     
    112115  {
    113116    ?>
    114     <div class="uploaded-content" style="display: flex; flex-direction: row;
     117    <div id="uploaded-content" class="uploaded-content" style="display: flex; flex-direction: row;
    115118    flex-wrap: wrap; width: 100%; height: 100%; box-sizing: border-box; align-items: center; justify-content: center;">
    116119    <?php
     
    151154    echo '<div class="synq-no-uploads">'.__('No uploaded videos found','synq-video').'</div>';
    152155  }
     156  wp_die();
     157}
     158
     159/* function that can be added to any page to call the above ajax page */
     160function print_my_uploads() {
     161  ?>
     162  <div id="content"></div>
     163  <script type="text/javascript" >
     164  jQuery(document).ready(function($) {
     165
     166    var data = {
     167      'action': 'uploadspage',
     168    };
     169
     170    // since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php
     171    jQuery.post(ajaxurl, data, function(response) {
     172      jQuery("#content").html(response);
     173      if(afterUploadsLoaded) afterUploadsLoaded();
     174    });
     175  });
     176  </script> <?php
    153177}
    154178
     
    247271  ?>
    248272  <script>
    249   function sendPostmessage(videoId){
    250     window.parent.postMessage(JSON.stringify({event: "synqShortcodeEvent", videoId: videoId}),"*");
    251     console.log("also test")
    252   }
    253   window.addEventListener('message', function (event) {
    254     // Make sure the event is from the synq uploader iframe.
    255     if(event.origin == "https://uploader.synq.fm"){
    256       eventObj = JSON.parse(event.data);
    257       // Check if it's an upload complete event.
    258       if(eventObj.event == "synqUploaderStatusChange" && eventObj.newStatus == "upload successful"){
    259         sendPostmessage(eventObj.videoId);
    260         // Upload completed successfully. Close media tab and insert shortcode.
    261       }
    262     }
    263   }, false);
    264 
    265     document.onreadystatechange = function() {
    266       if (document.readyState === 'complete') {
    267         elements = document.getElementsByClassName("search-result-img-holder");
    268         for(i = 0; i < elements.length; i++){
    269           e = elements[i];
    270           e.onclick = function(){
    271             sendPostmessage(this.dataset.videoId);
    272           }
     273    function sendPostmessage(videoId){
     274      window.parent.postMessage(JSON.stringify({event: "synqShortcodeEvent", videoId: videoId}),"*");
     275    }
     276    window.addEventListener('message', function (event) {
     277      // Make sure the event is from the synq uploader iframe.
     278      if(event.origin == "https://uploader.synq.fm"){
     279        eventObj = JSON.parse(event.data);
     280        // Check if it's an upload complete event.
     281        if(eventObj.event == "synqUploaderStatusChange" && eventObj.newStatus == "upload successful"){
     282          sendPostmessage(eventObj.videoId);
     283          // Upload completed successfully. Close media tab and insert shortcode.
    273284        }
    274285      }
    275     };
     286    }, false);
     287
     288    afterUploadsLoaded = function(){
     289      elements = document.getElementsByClassName("search-result-img-holder");
     290      for(i = 0; i < elements.length; i++){
     291        e = elements[i];
     292        e.onclick = function(){
     293          sendPostmessage(this.dataset.videoId);
     294        }
     295      }
     296    }
    276297  </script>
    277298  <style type="text/css">
     
    313334 */
    314335
    315 /* create short code for video player */
     336/* create shortcode for video player */
    316337/* "synq-video-player" should be used at all times. */
    317338add_shortcode('synq-video-player', 'synq_video_player');
Note: See TracChangeset for help on using the changeset viewer.