Various changes from git version and make autoplayer determine video type on lowercase url
authorymh <ymh.work@gmail.com>
Sun, 12 Nov 2017 22:07:33 +0100
changeset 1071 02c04d2c8fd8
parent 1070 36517cb225fe
child 1072 ac1eacb3aa33
Various changes from git version and make autoplayer determine video type on lowercase url
src/widgets/AutoPlayer.js
src/widgets/Polemic.js
src/widgets/Social.css
src/widgets/Social.js
--- a/src/widgets/AutoPlayer.js	Thu Dec 31 15:51:09 2015 +0100
+++ b/src/widgets/AutoPlayer.js	Sun Nov 12 22:07:33 2017 +0100
@@ -9,11 +9,11 @@
 };
 
 IriSP.Widgets.AutoPlayer.prototype.draw = function() {
-    
+
     if (typeof this.video === "undefined") {
         this.video = this.media.video;
     }
-    
+
     var _props = [ "live", "provider", "autostart", "streamer", "video", "height", "width", "url_transform" ],
         _opts = {},
         _types = [
@@ -22,7 +22,7 @@
                 type: "JwpPlayer"
             },
             {
-                regexp: /\.(mp4|m4v)$/,
+                regexp: /\.(mp4|m4v|mp3)$/,
                 type: "AdaptivePlayer"
             },
             {
@@ -43,28 +43,28 @@
             }
         ],
         _rtmprgx = /^rtmp:\/\//;
-    
+
     for (var i = 0; i < _types.length; i++) {
-        if (_types[i].regexp.test(this.video)) {
+        if (this.video && _types[i].regexp.test(this.video.toLowerCase())) {
             _opts.type =  _types[i].type;
             break;
         }
     }
-    
+
     if (typeof _opts.type === "undefined") {
         _opts.type = this.default_type;
     }
-    
+
     if (_opts.type === "AdaptivePlayer") {
         var _canPlayType = document.createElement('video').canPlayType('video/mp4; codecs="avc1.42E01E"');
         _opts.type = (_canPlayType !== "no") ? "HtmlPlayer" : "JwpPlayer";
     }
-    
+
     if (_rtmprgx.test(this.video)) {
         _opts.provider = "rtmp";
         _opts.live = true;
     }
-    
+
     for (var i = 0; i < _props.length; i++) {
         if (typeof this[_props[i]] !== "undefined") {
             _opts[_props[i]] = this[_props[i]];
@@ -72,5 +72,5 @@
     }
 
     this.insertSubwidget(this.$, _opts);
-    
-};
\ No newline at end of file
+
+};
--- a/src/widgets/Polemic.js	Thu Dec 31 15:51:09 2015 +0100
+++ b/src/widgets/Polemic.js	Sun Nov 12 22:07:33 2017 +0100
@@ -144,7 +144,7 @@
 
             for(var _j = 0; _j < _polemics.length; _j++) {
                 _pol = _polemics[_j];
-                _rgxp = _pol.rgxp || (_pol.rgxp = IriSP.Model.regexpFromTextOrArray(_pol.keywords));
+                _rgxp = IriSP.Model.regexpFromTextOrArray(_pol.keywords);
                 if(_rgxp.test(_annotation.description)) {
                     colAr.push(_pol.color);
                 }
@@ -346,27 +346,30 @@
                 polemicStacks : {}
             };
 
-        _count = _res.annotations.length;
         _res.annotations = _res.annotations.filter(function(_annotation) {
             var _polemicVersion = (_annotation.content && _annotation.content.polemic_version) || _this.default_version,
                 _polemics = _this.getPolemics(_polemicVersion) || [],
                 _pol,
                 _polKey,
                 _polDef,
-                _rgxp;
+                _rgxp,
+                _notMatched = true;
 
             for(var _j = 0; _j < _polemics.length; _j++) {
                 _pol = _polemics[_j];
-                _rgxp = _pol.rgxp || (_pol.rgxp = IriSP.Model.regexpFromTextOrArray(_pol.keywords));
+                _rgxp = IriSP.Model.regexpFromTextOrArray(_pol.keywords);
+
                 if(_rgxp.test(_annotation.description)) {
                     _polKey = _polemicVersion + "_" + _pol.name;
                     _polDef = _res.polemicStacks[_polKey] || (_res.polemicStacks[_polKey] = { 'polemicDef' : _pol, 'annotations': []});
                     _polDef.annotations.push(_annotation);
-                    return false;
+                    _notMatched = false;
+                    _count++;
                 }
             }
-            return true;
+            return _notMatched;
         });
+        _count += _res.annotations.length;
 
         _max = Math.max(_max, _count);
         _slices.push(_res);
--- a/src/widgets/Social.css	Thu Dec 31 15:51:09 2015 +0100
+++ b/src/widgets/Social.css	Sun Nov 12 22:07:33 2017 +0100
@@ -30,7 +30,7 @@
 }
 
 .Ldt-Social-Input {
-    width: 150px;
+    width: 200px;
 }
 
 .Ldt-Social-CopyBtn {
--- a/src/widgets/Social.js	Thu Dec 31 15:51:09 2015 +0100
+++ b/src/widgets/Social.js	Sun Nov 12 22:07:33 2017 +0100
@@ -2,7 +2,6 @@
 
 IriSP.Widgets.Social = function(player, config) {
     IriSP.Widgets.Widget.call(this, player, config);
-    ZeroClipboard.setMoviePath( IriSP.getLib('zeroClipboardSwf') );
 };
 
 IriSP.Widgets.Social.prototype = new IriSP.Widgets.Widget();
@@ -19,7 +18,7 @@
 
 IriSP.Widgets.Social.prototype.template =
     '<span class="Ldt-Social">{{#show_url}}<div class="Ldt-Social-Url-Container"><a href="#" draggable="true" target="_blank" class="Ldt-Social-Square Ldt-Social-Url Ldt-TraceMe" title="{{l10n.share_link}}">'
-    + '</a><div class="Ldt-Social-UrlPop"><input class="Ldt-Social-Input"/><div class="Ldt-Social-CopyBtn">{{l10n.copy}}</div></div></div>{{/show_url}}'
+    + '</a><div class="Ldt-Social-UrlPop"><input class="Ldt-Social-Input"/></div></div>{{/show_url}}'
     + '{{#show_fb}}<a href="#" target="_blank" class="Ldt-Social-Fb Ldt-Social-Ext Ldt-TraceMe" title="{{l10n.share_on}} Facebook"></a>{{/show_fb}}'
     + '{{#show_twitter}}<a href="#" target="_blank" class="Ldt-Social-Twitter Ldt-Social-Ext Ldt-TraceMe" title="{{l10n.share_on}} Twitter"></a>{{/show_twitter}}'
     + '{{#show_gplus}}<a href="#" target="_blank" class="Ldt-Social-Gplus Ldt-Social-Ext Ldt-TraceMe" title="{{l10n.share_on}} Google+"></a>{{/show_gplus}}'
@@ -68,23 +67,7 @@
 IriSP.Widgets.Social.prototype.toggleCopy = function() {
     var _pop = this.$.find(".Ldt-Social-UrlPop");
     _pop.toggle();
-    if (_pop.is(":visible")) {
-        if (typeof this.clip == "undefined") {
-            this.clip = new ZeroClipboard.Client();
-            this.clip.setHandCursor( true );
-            this.clip.glue(this.clipId);
-            var _this = this;
-            this.clip.addEventListener( 'onMouseUp', function() {
-                _pop.hide();
-                _this.clip.hide();
-            });
-        }
-        this.clip.show();
-        this.clip.setText( this.url );
-        this.$.find(".Ldt-Social-Input").val(this.url).focus();
-    } else {
-        this.clip.hide();
-    }
+    this.$.find(".Ldt-Social-Input").val(this.url).focus();
 };
 
 IriSP.Widgets.Social.prototype.updateUrls = function(_url, _text) {