Changeset 1568


Ignore:
Timestamp:
01/25/11 06:38:31 (2 years ago)
Author:
jeroen
Message:

added support for BOTR Facebook embeds and fixed an issue with url encoding

Location:
plugins/sharing/v5
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • plugins/sharing/v5/build/build.sh

    r1198 r1568  
    88$FLEXPATH/bin/mxmlc ../src/com/longtailvideo/plugins/sharing/Sharing.as -sp ../src -o ../sharing.swf -library-path+=../lib -load-externs=../lib/jwplayer-5-classes.xml -use-network=false -optimize=true -incremental=false 
    99 
     10# echo "Compiling library ..." 
     11 
    1012# $FLEXPATH/bin/compc -source-path ../src -output ../sharing.swc -compiler.library-path $FLEXPATH/frameworks/libs -compiler.library-path ../lib -include-classes com.longtailvideo.plugins.sharing.Sharing -link-report='../sharing-classes.xml' 
  • plugins/sharing/v5/src/com/longtailvideo/plugins/sharing/Sharing.as

    r1388 r1568  
    164164        /** hack for backward-compatible BOTR embeds **/ 
    165165        private function getBotrEmbed():String { 
    166             Logger.log(_player.config.playlistfile,'sharing'); 
    167166            var code:String = '<embed src="'; 
    168167            code += _player.config.playlistfile.substr(0,_player.config.playlistfile.indexOf('/',8)); 
     
    173172            code += ' allowfullscreen="true" />'; 
    174173            return code; 
     174        }; 
     175 
     176 
     177        /** hack for backward-compatible BOTR embeds **/ 
     178        private function getBotrPreview():String { 
     179            Logger.log(_player.config.playlistfile,'sharing'); 
     180            var link:String = ''; 
     181            link += _player.config.playlistfile.substr(0,_player.config.playlistfile.indexOf('/',8)); 
     182            link += '/previews/' + _player.playlist.currentItem['image'].substr(-12,8); 
     183            link += '-' + _config['code']; 
     184            return link; 
    175185        }; 
    176186 
     
    266276                var title:String = _player.playlist.currentItem['title']; 
    267277                if (_shareScreen.mouseX < 75) { 
    268                     url = 'http://www.facebook.com/share.php?u='+encodeURI(_shareField.text); 
     278                    if(_config['code'].toString().length == 8) { 
     279                        url = 'http://www.facebook.com/share.php?u='+getBotrPreview(); 
     280                    } else {  
     281                        url = 'http://www.facebook.com/share.php?u='+encodeURIComponent(_shareField.text); 
     282                    } 
    269283                    navigateToURL(new URLRequest(url)); 
    270284                } else if (_shareScreen.mouseX < 150) { 
    271285                    if(title) {  
    272                         url = 'http://twitter.com/home?status='+ title +': '+encodeURI(_shareField.text); 
     286                        url = 'http://twitter.com/?status='+ title +': '+encodeURIComponent(_shareField.text); 
    273287                    } else { 
    274                         url = 'http://twitter.com/home?status=' + encodeURI(_shareField.text); 
     288                        url = 'http://twitter.com/?status=' + encodeURIComponent(_shareField.text); 
    275289                    } 
    276290                    navigateToURL(new URLRequest(url)); 
    277291                } else if (_shareScreen.mouseX < 225) { 
    278292                    if(_config['code']) { 
    279                         url = 'http://www.myspace.com/Modules/PostTo/Pages/?c='+encodeURI(_embedField.text); 
     293                        url = 'http://www.myspace.com/Modules/PostTo/Pages/?c='+encodeURIComponent(_embedField.text); 
    280294                    } else { 
    281                         url = 'http://www.myspace.com/Modules/PostTo/Pages/?c='+encodeURI(_shareField.text); 
     295                        url = 'http://www.myspace.com/Modules/PostTo/Pages/?c='+encodeURIComponent(_shareField.text); 
    282296                    } 
    283                     if(title) { url += '&t=' + title; } 
     297                    if(title) { url += '&t=' + encodeURIComponent(title); } 
    284298                    navigateToURL(new URLRequest(url)); 
    285299                } else { 
    286                     url = 'mailto:?body='+encodeURI(_shareField.text); 
    287                     if(title) { url += '&subject=' + title; } 
     300                    url = 'mailto:?body='+encodeURIComponent(_shareField.text); 
     301                    if(title) { url += '&subject=' + encodeURIComponent(title); } 
    288302                    navigateToURL(new URLRequest(url),'_self'); 
    289303                } 
  • plugins/sharing/v5/test/assets/playlist.xml

    r1234 r1568  
    1515                        <description>This entry has no code defined, so the plugin uses the embed code of the current player.</description> 
    1616                        <enclosure url="http://content.bitsontherun.com/videos/nPripu9l-327.mp4" /> 
    17                         <jwplayer:sharing.link>http://www.longtailvideo.com</jwplayer:sharing.link> 
     17                        <jwplayer:sharing.link><![CDATA[http://www.longtailvideo.com?foo=bar&hash=#]]></jwplayer:sharing.link> 
    1818                </item> 
    1919 
Note: See TracChangeset for help on using the changeset viewer.