Skip to content

Commit

Permalink
Merge pull request #11 from yudeunagi/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
yudeunagi authored Jan 15, 2020
2 parents 32c7c4a + fb41eac commit 877f329
Show file tree
Hide file tree
Showing 9 changed files with 133 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
node_modules
unacast-darwin-x64
/electron-packager - ショートカット.lnk
Binary file modified documents/アプリアイコン.clip
Binary file not shown.
Binary file modified icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions public/css/style-server.css
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,30 @@ body {
}

body {
/*文字の縁取り*/
text-shadow: 1px 1px 0 #333,
-1px 1px 0 #333,
1px -1px 0 #333,
-1px -1px 0 #333;
}

/*レス表示部分の設定*/
.content {
color: rgba(255, 255, 255, 255); /*文字色*/
}


/*名前表示部分の設定*/
.name {
color: #55ff55;
}

/*時刻表示部分の設定*/
.date {
font-size : 0.8em;
color: #feffa0;
}

ul#res-list {
list-style-type: none;
/* レス表示部の左右の余白設定*/
Expand Down
9 changes: 8 additions & 1 deletion public/js/readThread.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,14 @@ var readThread = function(url){

//レスをリスト追加
function prependItems(html){
$('#res-list').prepend(html);

// 表示順オプションで上に追加するか下に追加するか選ぶ
if($('#dispSort').val() == 1){
$('#res-list').append(html);
}
else{
$('#res-list').prepend(html);
}
}

/** リクエスト作成
Expand Down
36 changes: 36 additions & 0 deletions src/html/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,42 @@ <h4>設定</h4>
<span class="mdl-textfield__error">0-99 までの数値を入れてください</span>
</div>

<div class="mdl-textfield mdl-js-textfield">
時刻表示<br/>
<label class = "mdl-radio mdl-js-radio" for="showTimeOn">
<input id="showTimeOn" class="mdl-radio__button" type="radio" name="showTime">
<span class = "mdl-radio__label">する</span>
</label>
<label class = "mdl-radio mdl-js-radio" for="showTimeOff">
<input id="showTimeOff" class="mdl-radio__button" type="radio" name="showTime">
<span class = "mdl-radio__label">しない</span>
</label>
</div>

<div class="mdl-textfield mdl-js-textfield">
レス表示順序<br/>
<label class = "mdl-radio mdl-js-radio" for="newResUp">
<input id="newResUp" class="mdl-radio__button" type="radio" name="dispSort">
<span class = "mdl-radio__label">新着が上</span>
</label>
<label class = "mdl-radio mdl-js-radio" for="newResDown">
<input id="newResDown" class="mdl-radio__button" type="radio" name="dispSort">
<span class = "mdl-radio__label">新着が下</span>
</label>
</div>

<div class="mdl-textfield mdl-js-textfield">
名前と本文を改行で分ける<br/>
<label class = "mdl-radio mdl-js-radio" for="disableNewLine">
<input id="disableNewLine" class="mdl-radio__button" type="radio" name="newLine">
<span class = "mdl-radio__label">分けない</span>
</label>
<label class = "mdl-radio mdl-js-radio" for="enableNewLine">
<input id="enableNewLine" class="mdl-radio__button" type="radio" name="newLine">
<span class = "mdl-radio__label">分ける</span>
</label>
</div>

<p>更新間隔 <span id="spanDisp">10</span></p>
<p style="width:80%">
<input id="rangeSpan" class="mdl-slider mdl-js-slider" type="range"
Expand Down
15 changes: 14 additions & 1 deletion src/main/getRes.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,20 @@ function buildResponse(res){
var $res = $('<span />', {class: 'res'}).append(res.text);

var $resDiv = $('<div />', {class: 'content'});
$resDiv.append($name).append(' ').append($res);

//時刻表示
//ここで改行化スペースを入れる
if(global.config.showTime == 1){
$date = $('<span />', {class: 'date'}).append(' ' + res.date);
$name.append($date);
}

//ここで改行化スペースを入れる
if(global.config.newLine == 1){
$resDiv.append($name).append('<br/>').append($res);
}else{
$resDiv.append($name).append(' ').append($res);
}

$li.append($icon);
$li.append($resDiv);
Expand Down
57 changes: 56 additions & 1 deletion src/renderer/renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,30 @@ function buildConfigJson() {
var interval = document.getElementById("rangeSpan").value;
var youtubeUrl = document.getElementById("text-youtube-url").value;

//時刻表示設定
var showTime = 0;
if(document.getElementById("showTimeOff").checked == true){
showTime = 0;
}else{
showTime = 1;
}

//表示順序設定
var dispSort = 0;
if(document.getElementById("newResUp").checked == true){
dispSort = 0;
}else{
dispSort = 1;
}

//改行設定
var newLine = 0;
if(document.getElementById("disableNewLine").checked == true){
newLine = 0;
}else{
newLine = 1;
}

var config = {
"url": url,
"resNumber": resNumber,
Expand All @@ -91,7 +115,10 @@ function buildConfigJson() {
"port": port,
"dipsNumber": dispNumber,
"interval": interval,
"youtubeUrl": youtubeUrl
"youtubeUrl": youtubeUrl,
"dispSort": dispSort,
"newLine": newLine,
"showTime": showTime
}

return config;
Expand All @@ -110,6 +137,10 @@ function saveConfigToLocalStrage(config){
localStorage.setItem('dipsNumber', config.dipsNumber);
localStorage.setItem('interval', config.interval);
localStorage.setItem('youtubeUrl', config.youtubeUrl);
localStorage.setItem('dispSort', config.dispSort);
localStorage.setItem('newLine', config.newLine);
localStorage.setItem('showTime', config.showTime);

console.log('[renderer.js]config saved');
}

Expand All @@ -133,6 +164,30 @@ function loadConfigToLocalStrage(){
initMessage = 'スレッド読み込みを開始しました';
}

// 時刻表示初期化
var showTime = localStorage.getItem('showTime');
if (showTime === null || showTime.length < 1 || showTime == 0){
document.getElementById("showTimeOff").checked = true;
}else{
document.getElementById("showTimeOn").checked = true;
}

// レス表示順ラジオ初期化
var dispSort = localStorage.getItem('dispSort');
if (dispSort === null || dispSort.length < 1 || dispSort == 0){
document.getElementById("newResUp").checked = true;
}else{
document.getElementById("newResDown").checked = true;
}

// 改行設定初期化
var newLine = localStorage.getItem('newLine');
if (newLine === null || newLine.length < 1 || newLine == 0){
document.getElementById("disableNewLine").checked = true;
}else{
document.getElementById("enableNewLine").checked = true;
}

document.getElementById("text-port-number").value = port;
document.getElementById("spanDisp").innerHTML = interval;
document.getElementById("rangeSpan").value = interval;
Expand Down
4 changes: 4 additions & 0 deletions views/server.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@
<input type="hidden" id="dispNumber" name="dispNumber" value="<%=dipsNumber%>" >
<input type="hidden" id="interval" name="interval" value="<%=interval%>" >
<input type="hidden" id="youtubeUrl" name="youtubeUrl" value="<%=youtubeUrl%>" >
<input type="hidden" id="dispSort" name="dispSort" value="<%=dispSort%>" >
<input type="hidden" id="newLine" name="newLine" value="<%=newLine%>" >
<input type="hidden" id="showTime" name="showTime" value="<%=showTime%>" >

</form>
<ul id="res-list">
<li>
Expand Down

0 comments on commit 877f329

Please sign in to comment.