Skip to content

Commit

Permalink
Merge commit '1dfad7dda27dd225303174d087a80b6e922f0059'
Browse files Browse the repository at this point in the history
  • Loading branch information
jzwalk committed Jan 29, 2017
2 parents e83e3a8 + 1dfad7d commit cde1568
Show file tree
Hide file tree
Showing 6 changed files with 1,306 additions and 394 deletions.
571 changes: 304 additions & 267 deletions AudioPlayer/Plugin.php

Large diffs are not rendered by default.

14 changes: 11 additions & 3 deletions AudioPlayer/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
### AudioPlayer 1.2.0 for Typecho 0.9
### Typecho音乐播放器插件AudioPlayer
2017年1月29日更新至**v1.2.5**:
- 修正摘要输出兼容feed提示

详细使用说明和效果演示见blog发布地址:
####http://www.jzwalk.com/archives/net/audio-player-for-typecho
2017年1月28日更新至**v1.2.4**:
- 重整结构优化嵌载模式效率
- 修复短代码标签冲突等bug
- 支持配色重置与中文url加密
- 增加缺省可使用HTML5播放

#### 详细说明与效果演示见blog发布地址:
> http://www.yzmb.me/archives/net/audio-player-for-typecho
73 changes: 40 additions & 33 deletions AudioPlayer/assets/audio-player-admin.css
Original file line number Diff line number Diff line change
@@ -1,61 +1,69 @@
#ap_colorscheme {
position:relative;
position: relative;
}

#ap_colorselector {
position:absolute;
top:130px;
left:165px;
}
#ap_colorselector input {
float: left;
margin: 0 5px 0 0;
padding: 2px;
position: absolute;
top: 42px;
left: 190px;
}

#ap_colorselector input {
float: left;
margin-right: 5px;
padding: 2px;
width: 75px;
height: 23px;
text-transform : uppercase
}

#ap_colorsample {
float: left;
width: 19px;
height: 19px;
border: 1px solid #000000;
width: 20px;
height: 20px;
border: 1px solid #444;
background: #FFFFFF;
}

#ap_picker-btn {
display: block;
float: left;
height: 21px;
height: 23px;
background: url(picker-icon.png) no-repeat left top;
padding-top: 1px;
padding-left: 28px;
padding-top: 3px;
margin-left: 10px;
font-size: 11px;
margin-left: 13px;
font-size: 13px;
cursor: pointer;
color: #0000FF;
text-decoration: underline;
color: #467B96;
}

#ap_themecolor-btn {
display: block;
float: left;
height: 21px;
height: 23px;
background: url(theme-picker-icon.png) no-repeat left top;
padding-left: 28px;
padding-top: 3px;
margin-left: 10px;
font-size: 11px;
padding-top: 1px;
padding-left: 24px;
margin-left: 11px;
font-size: 13px;
cursor: pointer;
color: #0000FF;
text-decoration: underline;
color: #467B96;
}

#ap_resetcolor {
position: absolute;
bottom: 49px;
left: 132px;
height: 22px;
padding-bottom: 2px;
margin-bottom: 1.5px;
}

#ap_themecolor {
display: none;
width: 134px;
padding: 0 0 13px 0;
padding-bottom: 13px;
float: left;
background: url(thcpck-bottom.png) no-repeat left bottom;
}
Expand All @@ -64,14 +72,14 @@
display: block;
text-indent: -9999px;
height: 13px;
line-height: 0;
font-size: 0;
background: url(thcpck-top.png) no-repeat left top;
}

#ap_themecolor ul {
background: url(thcpck-slice.png) repeat-y left top;
padding: 1px 14px 1px 15px;
padding-top: 2px;
padding-right: 14px;
padding-left: 15px;
float: left;
width: 105px;
margin: 0;
Expand All @@ -84,7 +92,6 @@
float: left;
width: 20px;
height: 20px;
margin: 0 1px 1px 0;
line-height: 0;
font-size: 0;
}
margin-right: 1px;
margin-bottom: 1px;
}
121 changes: 31 additions & 90 deletions AudioPlayer/assets/audio-player-admin.js
Original file line number Diff line number Diff line change
@@ -1,41 +1,40 @@
(function ($) {
var timer,
fieldSelector,
var fieldSelector,
currentKey,
colorField,
colorPicker,
colorSwatch,
currentColorField,
player;

var init = function () {


// 配色组件控制
fieldSelector = $("#ap_fieldselector");
currentKey = fieldSelector.val();
colorField = $("#ap_colorvalue");
colorPicker = $("#ap_picker-btn");
colorSwatch = $("#ap_colorsample");
currentColorField = $("#ap_" + fieldSelector.val() + "color");


fieldSelector.change(function () {
currentColorField = $("#ap_" + fieldSelector.val() + "color");
colorField.val(currentColorField.val());
colorPicker.ColorPickerSetColor(currentColorField.val());
colorSwatch.css("background-color", currentColorField.val());
currentKey = fieldSelector.val();
colorField.val(colorDatas[currentKey]);
colorPicker.ColorPickerSetColor(colorDatas[currentKey]);
colorSwatch.css("background-color", colorDatas[currentKey]);
});

colorField.keyup(function () {
var color = colorField.val();
if (color.match(/#?[0-9a-f]{6}/i)) {
currentColorField.val(color);
colorDatas[currentKey] = color;
colorSwatch.css("background-color", color);
colorPicker.ColorPickerSetColor(currentColorField.val());
colorPicker.ColorPickerSetColor(colorDatas[currentKey]);
updatePlayer();
}
});

var themeColorPicker = $("#ap_themecolor");
if (themeColorPicker) {
themeColorPicker.css("display", "none");
//reorderThemeColors();
themeColorPickerBtn = $("#ap_themecolor-btn");
themeColorPickerBtn.click(function (evt) {
themeColorPicker.css({
Expand All @@ -51,7 +50,7 @@
color = color.replace(/#(.)(.)(.)/, "#$1$1$2$2$3$3");
}
colorField.val(color);
currentColorField.val(color);
colorDatas[currentKey] = color;
colorSwatch.css("background-color", color);
updatePlayer();
$("#ap_themecolor").css("display", "none");
Expand All @@ -61,99 +60,41 @@
themeColorPicker.hide();
});
}

colorPicker.ColorPicker({
onChange: function (hsb, hex, rgb) {
var color = "#" + hex;
colorField.val(color);
currentColorField.val(color);
colorDatas[currentKey] = color;
colorSwatch.css("background-color", color);
updatePlayer();
},

onShow: function () {
themeColorPicker.hide();
}
});

selectColorField();
}

var tabClick = function (evt) {
var i;
var target = $(this);
var tab = target.parent();

evt.preventDefault();

if (tab.attr("class") == "current") {
return;
}

tabs.removeClass("current");
tab.addClass("current");

panels.css("display", "none");

var activeTabID = target.attr("href").replace(/[^#]*#/, "");

$("#" + activeTabID).css("display", "block");

if (activeTabID == "ap_panel-colour") {
timer = setTimeout(updatePlayer, 100);
} else if (timer) {
clearTimeout(timer);
}
}

var selectColorField = function () {
currentColorField = $("#ap_" + fieldSelector.val() + "color");
colorField.val(currentColorField.val());
colorPicker.ColorPickerSetColor(currentColorField.val());
colorSwatch.css("background-color", currentColorField.val());
currentKey = fieldSelector.val();
colorField.val(colorDatas[currentKey]);
colorPicker.ColorPickerSetColor(colorDatas[currentKey]);
colorSwatch.css("background-color", colorDatas[currentKey]);
}

var updatePlayer = function () {
player = audioplayer_swfobject.getObjectById("ap_demoplayer");
$(".typecho-option input[type=hidden]").each(function (i) {
player.SetVariable($(this).attr("name").replace(/ap_(.+)color/, "$1"), $(this).val().replace("#", ""));

$.each(colorDatas, function(name,value){
player.SetVariable(name, value.replace("#", ""));
});
player.SetVariable("setcolors", 1);
// 更新json到隐藏域
colorInput.val(JSON.stringify(colorDatas));
}

/*var reorderThemeColors = function () {
var swatchList = this.themeColorPicker.getElement("ul");
var swatches = swatchList.getElements("li");
swatches.sort(function (a, b) {
var colorA = new Color(a.getProperty("title"));
var colorB = new Color(b.getProperty("title"));
colorA = colorA.rgbToHsb();
colorB = colorB.rgbToHsb();
if (colorA[2] < colorB[2]) {
return 1;
}
if (colorA[2] > colorB[2]) {
return -1;
}
return 0;
});
swatches.each(function (swatch) {
swatch.injectTop(swatchList);
});
}*/

var pickThemeColor = function (evt) {
var color = target.attr("title");
if (color.length == 4) {
color = color.replace(/#(.)(.)(.)/, "#$1$1$2$2$3$3");
}
$("#ap_colorvalue").val(color);
getCurrentColorField().val(color);
updatePlayer();
$("#ap_picker-btn").ColorPickerSetColor(color);
$("ap_colorsample").css("background-color", color);
$("#ap_themecolor").css("display", "none");
}

$(init);
})(jQuery);
Loading

0 comments on commit cde1568

Please sign in to comment.