Skip to content

Commit

Permalink
Merge pull request #47 from gloomy-ghost/dev-hotfix
Browse files Browse the repository at this point in the history
Fix colour settings #45 #46
  • Loading branch information
p0we7 authored Mar 23, 2017
2 parents eb19fdf + bc1b026 commit 09bf7d6
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 31 deletions.
2 changes: 1 addition & 1 deletion background.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ browser.runtime.onMessage.addListener(function(request, sender, sendResponse) {
}else if ( request.get_allSetting ){
sendResponse({dblclickToTop: Number(s.getItem('dblclickToTop'))});
}else if ( request.get_replySetting ){
sendResponse({keyReplyColor: s.getItem('replyColor'), keyReplyA: s.getItem('replyA'), fold: s.getItem('fold'), thankColor: s.getItem('thankColor')});
sendResponse({replyColor: s.getItem('replyColor'), replyA: s.getItem('replyA'), fold: s.getItem('fold'), thankColor: s.getItem('thankColor')});
}else if ( request.get_newWindow_status ){
sendResponse({newWindow_status: Number(s.getItem('newWindow'))});
}else if ( request.get_blockList ){
Expand Down
4 changes: 2 additions & 2 deletions block_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
<html lang="en">
<head>
<meta charset="UTF-8">
<script type="text/javascript" language="javascript" charset="UTF-8" src="jquery191.js"></script>
<script type="text/javascript" language="javascript" charset="UTF-8" src="block_list.js"></script>
<script src="jquery-3.2.0.min.js"></script>
<script src="block_list.js"></script>
<title>v2ex plus - 屏蔽列表</title>
<style type="text/css">
body{
Expand Down
8 changes: 4 additions & 4 deletions options.html
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,10 @@ <h1>选项:</h1>
新标签页浏览主题:&nbsp;&nbsp;&nbsp;<input type="radio" name="newWindow" value="1" disabled="disabled" />开启
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="radio" name="newWindow" value="0" disabled="disabled" />关闭
</form></li>
<li><form name="keyReplyColorSelect">
楼主回复背景色:&nbsp;&nbsp;&nbsp;&nbsp;<input type="color" name="keyReplyColor" disabled="disabled" />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;透明度:<span id="keyReplyAValue" style="display:inline-block; width:2em" >稍后</span>
<input type="range" name="keyReplyA" min="0.00" max="1.00" step="0.05" disabled="disabled" style="width:100px" />
<li><form name="replyColorSelect">
楼主回复背景色:&nbsp;&nbsp;&nbsp;&nbsp;<input type="color" name="replyColor" disabled="disabled" />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;透明度:<span id="replyAValue" style="display:inline-block; width:2em" >稍后</span>
<input type="range" name="replyA" min="0.00" max="1.00" step="0.05" disabled="disabled" style="width:100px" />
</form></li>
<li><form name="thankColorSelect">
感谢爱心颜色:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="color" name="thankColor" disabled="disabled" />
Expand Down
24 changes: 12 additions & 12 deletions options.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,25 +68,25 @@ function saveChoice(e){
}

//楼主回复背景色 默认rgba('255', '255', '249', '0.4')
const _keyReplyColor = document.keyReplyColorSelect.keyReplyColor,
_keyReplyA = document.keyReplyColorSelect.keyReplyA,
_keyReplyAValue = document.getElementById("keyReplyAValue");
_keyReplyColor.value = s.getItem('replyColor');
_keyReplyA.value = _keyReplyAValue.innerHTML = s.getItem('replyA');
const _replyColor = document.replyColorSelect.replyColor,
_replyA = document.replyColorSelect.replyA,
_replyAValue = document.getElementById("replyAValue");
_replyColor.value = s.getItem('replyColor');
_replyA.value = _replyAValue.innerHTML = s.getItem('replyA');

_keyReplyColor.onchange = function(e){
_replyColor.onchange = function(e){
let hex = this.value.toLowerCase();
s.setItem('replyColor', hex);
};
_keyReplyA.onmousemove = function(e){
_keyReplyAValue.innerHTML = this.value;
_replyA.onmousemove = function(e){
_replyAValue.innerHTML = this.value;
};
_keyReplyA.onchange = function(e){
_keyReplyAValue.innerHTML = this.value;
_replyA.onchange = function(e){
_replyAValue.innerHTML = this.value;
saveChoice(e);
};
_keyReplyA.disabled = false;
_keyReplyColor.disabled = false;
_replyA.disabled = false;
_replyColor.disabled = false;

//感谢爱心颜色 默认rgba('204', '204', '204', '1')
const _thankColor = document.thankColorSelect.thankColor;
Expand Down
20 changes: 8 additions & 12 deletions v2ex_reply.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ function input_img( input_img_base64, this_img_id ){
var _reply_user_name_list = Array();
var _reply_content_list = Array();
var r_i = 1;
var keyReplyColor;
var replyColor;

_topic_buttons.append(" &nbsp;<a href='#;' id='onlyKeyUser' class='tb'>只看楼主</a>");

Expand Down Expand Up @@ -185,11 +185,11 @@ function input_img( input_img_base64, this_img_id ){

chrome.runtime.sendMessage({get_replySetting: 't'}, function(response) {
var topic_height = _topic.height();
r = parseInt((response.keyReplyColor).substring(1,3),16);
g = parseInt((response.keyReplyColor).substring(3,5),16);
b = parseInt((response.keyReplyColor).substring(5,7),16);
keyReplyColor = r+','+g+','+b+','+response.keyReplyA;
$('.keyUser').css('backgroundColor', 'rgba('+ keyReplyColor +')');//设置楼主回复背景颜色
r = parseInt((response.replyColor).substring(1,3),16);
g = parseInt((response.replyColor).substring(3,5),16);
b = parseInt((response.replyColor).substring(5,7),16);
replyColor = r+','+g+','+b+','+response.replyA;
$('.keyUser').css('backgroundColor', 'rgba('+ replyColor +')');//设置楼主回复背景颜色
if (!response.fold){//折叠超长主题
if (topic_height>1800){
_topic_content.css({maxHeight:'600px', overflow:'hidden', transition:'max-height 2s'});
Expand Down Expand Up @@ -228,14 +228,10 @@ function input_img( input_img_base64, this_img_id ){
}

//————————高亮感谢————————

$('.box .small.fade').each(function(){
var $this = $(this);
if ($this.text().indexOf('♥')!=-1) {
$this.css('color', 'rgb(' + (response.thankColor || '204,204,204') + ')');
}
if ($(this).text().indexOf('♥') !== -1)
$(this).css('color', response.thankColor);
});

//————————高亮感谢————————


Expand Down

0 comments on commit 09bf7d6

Please sign in to comment.