fix xiami playing problem (protocol relative url)

This commit is contained in:
Listen 1 2018-04-23 19:20:03 +08:00
parent 4ea3a1cf9d
commit fd68df56f9
5 changed files with 17 additions and 8 deletions

View File

@ -1,6 +1,6 @@
Listen 1 (Chrome Extension) V1.5.2
Listen 1 (Chrome Extension) V1.6.0
==========
最后更新于2018年02月18日)
最后更新于2018年04月23日)
[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg)](LICENSE)
@ -45,6 +45,9 @@ Firefox打包安装
更新日志
-------
`2018-04-23`
* 修复虾米音乐无法播放的问题
`2018-02-18`
* 修复无法创建歌单的bug

View File

@ -30,6 +30,12 @@ var xiami = (function() {
return unescape(s.join('')).replace(/\^/g, '0');
}
function handleProtocolRelativeUrl(url){
var regex = /^.*?\/\//;
var result = url.replace(regex, 'http://');
return result;
}
function xm_retina_url(s){
if (s.slice(-6, -4) == '_1') {
return s.slice(0, -6) + s.slice(-4);
@ -56,7 +62,7 @@ var xiami = (function() {
'id': '',
'source_url': ''
};
default_playlist.cover_img_url = $(this).find('img')[0].src;
default_playlist.cover_img_url = handleProtocolRelativeUrl($(this).find('img')[0].src);
default_playlist.title = $(this).find('h3 a')[0].title;
var xiami_url = $(this).find('h3 a')[0].href;
var list_id = xiami_url.split('?')[0].split('/').pop()
@ -115,8 +121,8 @@ var xiami = (function() {
return;
}
var location = data.data.trackList[0].location;
sound.url = caesar(location);
track.img_url = xm_retina_url(data.data.trackList[0].pic);
sound.url = handleProtocolRelativeUrl(caesar(location));
track.img_url = xm_retina_url(handleProtocolRelativeUrl(data.data.trackList[0].pic));
track.album = data.data.trackList[0].album_name;
track.album_id = 'xmalbum_' + data.data.trackList[0].album_id;
track.lyric_url = data.data.trackList[0].lyric_url;

View File

@ -351,7 +351,7 @@
<div class="settings-content">
<p> Listen 1 主页: <a href="http://listen1.github.io/listen1/" target="_blank"> http://listen1.github.io/listen1/ </a> </p>
<p> Listen 1 邮箱: githublisten1@gmail.com </p>
<p> 当前版本 1.5.2 (本软件基于MIT协议开源免费)</p>
<p> 当前版本 1.6.0 (本软件基于MIT协议开源免费)</p>
</div>
</div>
</div>

View File

@ -15,7 +15,7 @@
"manifest_version": 2,
"name": "Listen 1",
"permissions": [ "notifications", "unlimitedStorage", "downloads", "storage", "contextMenus", "tabs", "*://music.163.com/*", "*://*.xiami.com/*", "*://*.qq.com/*", "*://api.github.com/*", "*://github.com/*", "webRequest", "webRequestBlocking"],
"version": "1.5.2",
"version": "1.6.0",
"web_accessible_resources": [ "images/*" ],
"content_scripts": [{
"matches": ["https://listen1.github.io/listen1/*"],

View File

@ -21,7 +21,7 @@
"manifest_version": 2,
"name": "Listen 1",
"permissions": [ "notifications", "unlimitedStorage", "downloads", "storage", "contextMenus", "tabs", "*://music.163.com/*", "*://*.xiami.com/*", "*://*.qq.com/*", "*://api.github.com/*", "*://github.com/*", "webRequest", "webRequestBlocking"],
"version": "1.5.2",
"version": "1.6.0",
"web_accessible_resources": [ "images/*" ],
"content_scripts": [{
"matches": ["https://listen1.github.io/listen1/*"],