narou 2.4.0 → 2.4.1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of narou might be problematic. Click here for more details.

Files changed (36) hide show
  1. checksums.yaml +4 -4
  2. data/ChangeLog.md +21 -2
  3. data/README.md +20 -15
  4. data/lib/command/update.rb +37 -11
  5. data/lib/converterbase.rb +3 -3
  6. data/lib/downloader.rb +65 -9
  7. data/lib/helper.rb +7 -0
  8. data/lib/novelinfo.rb +4 -6
  9. data/lib/version.rb +1 -1
  10. data/lib/web/appserver.rb +7 -0
  11. data/lib/web/public/resources/narou.library.js +41 -1
  12. data/lib/web/public/resources/narou.ui.js +34 -0
  13. data/lib/web/views/index.haml +10 -0
  14. data/lib/web/views/style.scss +20 -1
  15. data/narou.gemspec +13 -21
  16. data/spec/data/convert_test/auto_indent/correct_test_auto_indent.txt +1 -0
  17. data/spec/data/convert_test/auto_join_bracket/correct_test_auto_join_bracket.txt +1 -0
  18. data/spec/data/convert_test/auto_join_line/correct_test_auto_join_line.txt +1 -0
  19. data/spec/data/convert_test/convert_page_break/correct_test_convert_page_break.txt +1 -0
  20. data/spec/data/convert_test/english/correct_test_english.txt +1 -0
  21. data/spec/data/convert_test/horizontal_ellipsis/correct_test_horizontal_ellipsis.txt +1 -0
  22. data/spec/data/convert_test/insert_separator/correct_test_insert_separator.txt +1 -0
  23. data/spec/data/convert_test/insert_separator_and_replace_txt/correct_test_insert_separator_and_replace_txt.txt +1 -0
  24. data/spec/data/convert_test/kanji_num/correct_test_kanji_num.txt +1 -0
  25. data/spec/data/convert_test/nonokagi/correct_test_nonokagi.txt +1 -0
  26. data/spec/data/convert_test/replace/correct_test_replace.txt +1 -0
  27. data/spec/data/convert_test/ruby/correct_test_ruby.txt +1 -0
  28. data/spec/data/convert_test/ruby_youon/correct_test_ruby_youon.txt +1 -0
  29. data/spec/data/convert_test/sesame/correct_test_sesame.txt +1 -0
  30. data/spec/data/convert_test/to_odd_leader/correct_test_to_odd_leader.txt +1 -0
  31. data/spec/helper_spec.rb +10 -0
  32. data/spec/novelinfo_spec.rb +0 -5
  33. data/webnovel/syosetu.org.yaml +1 -1
  34. data/webnovel/www.akatsuki-novels.com.yaml +3 -2
  35. data/webnovel/www.mai-net.net.yaml +3 -3
  36. metadata +15 -23
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e9304a718adb9745c4a5a09784a829070350e074
4
- data.tar.gz: df071e525661f21cf51a9be4e792926023a97f60
3
+ metadata.gz: 84d9279d93153de077c9219712b23ae1213b4567
4
+ data.tar.gz: 931e3a076a1f18b7170e35c828c1141cd77de3ef
5
5
  SHA512:
6
- metadata.gz: 8d39fbd258a06299a2654561d0bda11d1ba7a3357256ce4a22546f80ae9d50657e43c0bee63bbc2b1a4085700b585ba23af83c77aa6d2f8b924fc7a7da0b902c
7
- data.tar.gz: 961801e930b51c052f5cf0b225b7e91dd25b319319cda56bddd78a97460a67e89385027cbdf5a17d3019542037c58fcfefac15245aa0bb5e0ca48b2f2f21dacd
6
+ metadata.gz: 0c5bbe26be7fdae850e6333d56fcff6083614c9114128f19dc4687a14d3ba104d80b60f0212a373f05e5e2d22ca14c26a26984b5096818e9a08e962d1fb6a9fa
7
+ data.tar.gz: 586850fdb42f648a08575b3f5ced281313313a2447abd326c3745b7a5554edc051354edafdc78b7789759dc63fad19fe9bbb843a62b72f055ecd85431ee5a8ae
data/ChangeLog.md CHANGED
@@ -2,6 +2,26 @@
2
2
  更新履歴 - ChangeLog
3
3
  ====================
4
4
 
5
+ 2.4.1 : 2015/05/24
6
+ ------------------
7
+ #### 追加機能
8
+ - WEB UI の Update ボタンに「表示されている小説を更新」、「最新話掲載日を更新」
9
+ という選択肢を追加しました
10
+ + 表示されている小説を更新:見える範囲内の小説を選択せずに更新出来る。タグ検
11
+ 索やフィルターで絞り込んだあとにいちいち選択する必要がなくなる
12
+ + 最新話掲載日を更新: `narou u --gl` を WEB UI からも実行出来るようにした物
13
+
14
+ #### 仕様変更
15
+ - WEB UI の項目「最新話掲載日」をArcadia及び暁にも対応させました
16
+ + それに伴い `narou u --gl` コマンドもArcadiaと暁に対応します
17
+ - `narou u --gl` コマンドが凍結済み小説は無視するように変更しました
18
+ - 最新話掲載日の経過日時表記に「3d」(3日以内に掲載)を追加しました
19
+
20
+ #### Bug Fix
21
+ - WEB UI のタグ検索が部分一致になっていたのを完全一致に修正しました
22
+ - 連続したミュートが正しく変換できていなかったのを修正
23
+
24
+
5
25
  2.4.0 : 2015/05/16
6
26
  ------------------
7
27
  #### 追加機能
@@ -9,8 +29,7 @@
9
29
  - WEB UI に項目「最新話掲載日」を追加しました
10
30
  + 「小説家になろう」と「ハーメルン」のみ対応しています(updateした小説から
11
31
  反映されていきます)。更新が無いと反映されないため、手動で反映させたい場合
12
- はWEB UI サーバを落とした状態で `narou u --gl` コマンドを使用して下さい。
13
- (基本的に一度実行するだけで十分です)
32
+ はWEB UI サーバを落とした状態で `narou u --gl` コマンドを使用して下さい
14
33
 
15
34
  #### 仕様変更
16
35
  - 小説リストの「新着」及び「更新」の表示基準を調整しました
data/README.md CHANGED
@@ -26,6 +26,26 @@ Narou.rb ― 「小説家になろう」「小説を読もう!」ダウンロ
26
26
  更新履歴 - ChangeLog
27
27
  --------------------
28
28
 
29
+ 2.4.1 : 2015/05/24
30
+ ------------------
31
+ #### 追加機能
32
+ - WEB UI の Update ボタンに「表示されている小説を更新」、「最新話掲載日を更新」
33
+ という選択肢を追加しました
34
+ + 表示されている小説を更新:見える範囲内の小説を選択せずに更新出来る。タグ検
35
+ 索やフィルターで絞り込んだあとにいちいち選択する必要がなくなる
36
+ + 最新話掲載日を更新: `narou u --gl` を WEB UI からも実行出来るようにした物
37
+
38
+ #### 仕様変更
39
+ - WEB UI の項目「最新話掲載日」をArcadia及び暁にも対応させました
40
+ + それに伴い `narou u --gl` コマンドもArcadiaと暁に対応します
41
+ - `narou u --gl` コマンドが凍結済み小説は無視するように変更しました
42
+ - 最新話掲載日の経過日時表記に「3d」(3日以内に掲載)を追加しました
43
+
44
+ #### Bug Fix
45
+ - WEB UI のタグ検索が部分一致になっていたのを完全一致に修正しました
46
+ - 連続したミュートが正しく変換できていなかったのを修正
47
+
48
+
29
49
  2.4.0 : 2015/05/16
30
50
  ------------------
31
51
  #### 追加機能
@@ -55,21 +75,6 @@ Narou.rb ― 「小説家になろう」「小説を読もう!」ダウンロ
55
75
  を修正
56
76
 
57
77
 
58
- 2.3.3 : 2015/04/24
59
- ------------------
60
- #### Bug Fix
61
- - `enable_ruby_youon_to_big` で拗音が大きくならない場合があったのを修正
62
- - WEB UI 起動中にタイトルやあらすじが変更された場合に反映されない場合があった
63
- のを修正
64
- + アップデート時に10分以上経ったキャッシュは捨てるようにしました
65
-
66
-
67
- 2.3.2 : 2015/04/01
68
- ------------------
69
- #### Bug Fix
70
- - `enable_insert_char_separator` でルビ及び外字注記が壊れる問題を修正
71
-
72
-
73
78
 
74
79
  ----
75
80
 
@@ -156,29 +156,55 @@ module Command
156
156
  end
157
157
  end
158
158
 
159
- def update_general_lastup
159
+ def update_general_lastup(through_frozen_novel: true)
160
160
  database = Database.instance
161
- progressbar = ProgressBar.new(database.get_object.size - 1)
162
161
  puts "最新話掲載日を更新しています..."
162
+ progressbar = ProgressBar.new(database.get_object.size - 1)
163
163
  database.each.with_index do |(id, data), i|
164
164
  progressbar.output(i)
165
+ if through_frozen_novel
166
+ next if Narou.novel_frozen?(id)
167
+ end
165
168
  setting = Downloader.get_sitesetting_by_target(id)
166
169
  begin
167
170
  info = NovelInfo.load(setting)
168
171
  rescue OpenURI::HTTPError, Errno::ECONNRESET => e
172
+ setting.clear
169
173
  next
170
174
  end
171
- next unless info
172
- next unless info["title"]
173
- data = {
174
- "general_firstup" => info["general_firstup"],
175
- "novelupdated_at" => info["novelupdated_at"],
176
- "general_lastup" => info["general_lastup"]
177
- }
178
- database[id].merge!(data)
175
+ if info
176
+ dates = {
177
+ "general_firstup" => info["general_firstup"],
178
+ "novelupdated_at" => info["novelupdated_at"],
179
+ "general_lastup" => info["general_lastup"]
180
+ }
181
+ else
182
+ # 小説情報ページがない場合は目次から取得する
183
+ begin
184
+ dates = get_latest_dates(setting)
185
+ rescue OpenURI::HTTPError, Errno::ECONNRESET => e
186
+ setting.clear
187
+ next
188
+ end
189
+ end
190
+ database[id].merge!(dates)
191
+ setting.clear
179
192
  end
180
193
  database.save_database
181
- puts "\n更新が完了しました"
194
+ progressbar.clear
195
+ puts "更新が完了しました"
196
+ end
197
+
198
+ # オンラインの目次からgeneral_lastupを取得する
199
+ # ただし、toc.yaml に最新話が存在し、かつsubdateが設定されていたらそれを使う
200
+ def get_latest_dates(setting)
201
+ downloader = Downloader.new(setting)
202
+ old_toc = downloader.load_toc_file
203
+ latest_toc = downloader.get_latest_table_of_contents(old_toc, through_error: true)
204
+ {
205
+ "novelupdated_at" => downloader.get_novelupdated_at,
206
+ "general_lastup" => downloader.get_general_lastup
207
+ }
182
208
  end
183
209
  end
184
210
  end
data/lib/converterbase.rb CHANGED
@@ -341,9 +341,9 @@ class ConverterBase
341
341
  # 半角記号を全角に変換
342
342
  #
343
343
  def symbols_to_zenkaku(data)
344
- data.gsub!(/[#{SINGLE_MINUTE_FAMILY}]([^"\n]+)[#{SINGLE_MINUTE_FAMILY}]/, "〝\\1〟")
344
+ data.gsub!(/[#{SINGLE_MINUTE_FAMILY}]([^"\n]+?)[#{SINGLE_MINUTE_FAMILY}]/, "〝\\1〟")
345
345
  # MEMO: シングルミュートを表示出来るフォントはほとんど無いためダブルにする
346
- data.gsub!(/[#{DOUBLE_MINUTE_FAMILY}]([^"\n]+)[#{DOUBLE_MINUTE_FAMILY}]/, "〝\\1〟")
346
+ data.gsub!(/[#{DOUBLE_MINUTE_FAMILY}]([^"\n]+?)[#{DOUBLE_MINUTE_FAMILY}]/, "〝\\1〟")
347
347
  data.tr!("-=+/*《》'\"%$#&!?<><>()|‐,._;:[]",
348
348
  "-=+/*≪≫’”%$#&!?〈〉〈〉()|-,._;:[]")
349
349
  data.gsub!("\\", "¥")
@@ -1036,7 +1036,7 @@ class ConverterBase
1036
1036
  # 見出しの次の行が空行ではない場合空行を追加する
1037
1037
  add_tail = "\n" * (2 - calc_cr_count(rest))
1038
1038
  # 見出しと本文の間には空行を2行挟む
1039
- "[#改ページ]\n#{midashi(m1)}\n#{add_tail}"
1039
+ "[#改ページ]\n\n#{midashi(m1)}\n#{add_tail}"
1040
1040
  end
1041
1041
  end
1042
1042
  # 前書きがある場合は、前書き→見出しの順番を見出し→前書きに入れ替えて置換
data/lib/downloader.rb CHANGED
@@ -361,11 +361,16 @@ class Downloader
361
361
  ).freeze
362
362
  end
363
363
 
364
+ def load_toc_file
365
+ load_novel_data(TOC_FILE_NAME)
366
+ end
367
+
364
368
  #
365
369
  # ダウンロード処理本体
366
370
  #
367
371
  def run_download
368
- latest_toc = get_latest_table_of_contents
372
+ old_toc = @new_novel ? nil : load_toc_file
373
+ latest_toc = get_latest_table_of_contents(old_toc)
369
374
  unless latest_toc
370
375
  error @setting["toc_url"] + " の目次データが取得出来ませんでした"
371
376
  return :failed
@@ -376,7 +381,6 @@ class Downloader
376
381
  return :canceled
377
382
  end
378
383
  end
379
- old_toc = @new_novel ? nil : load_novel_data(TOC_FILE_NAME)
380
384
  unless old_toc
381
385
  init_novel_dir
382
386
  old_toc = {}
@@ -541,6 +545,42 @@ class Downloader
541
545
  FileUtils.remove_entry_secure(@cache_dir, true) if @cache_dir
542
546
  end
543
547
 
548
+ def __search_latest_update_time(key, subtitles)
549
+ latest = Time.new(0)
550
+ subtitles.each do |subtitle|
551
+ time = Helper.date_string_to_time(subtitle[key])
552
+ latest = time if latest < time
553
+ end
554
+ latest
555
+ end
556
+
557
+ #
558
+ # 小説が更新された日をTime型で取得
559
+ #
560
+ def get_novelupdated_at
561
+ info = @setting["info"] || {}
562
+ if info["novelupdated_at"]
563
+ info["novelupdated_at"]
564
+ else
565
+ __search_latest_update_time("subupdate", @setting["subtitles"])
566
+ end
567
+ end
568
+
569
+ #
570
+ # 小説の最新掲載日をTime型で取得
571
+ #
572
+ # 小説家になろう、ハーメルンは小説情報ページの最終話掲載日などから取得した日付
573
+ # その他サイトは一番新しい話の投稿日(更新日ではない)
574
+ #
575
+ def get_general_lastup
576
+ info = @setting["info"] || {}
577
+ if info["general_lastup"]
578
+ info["general_lastup"]
579
+ else
580
+ __search_latest_update_time("subdate", @setting["subtitles"])
581
+ end
582
+ end
583
+
544
584
  #
545
585
  # データベース更新
546
586
  #
@@ -559,8 +599,8 @@ class Downloader
559
599
  "new_arrivals_date" => (@new_arrivals ? Time.now : @@database[@id]["new_arrivals_date"]),
560
600
  "use_subdirectory" => @download_use_subdirectory,
561
601
  "general_firstup" => info["general_firstup"],
562
- "novelupdated_at" => info["novelupdated_at"],
563
- "general_lastup" => info["general_lastup"],
602
+ "novelupdated_at" => get_novelupdated_at,
603
+ "general_lastup" => get_general_lastup,
564
604
  }
565
605
  if @@database[@id]
566
606
  @@database[@id].merge!(data)
@@ -677,7 +717,7 @@ class Downloader
677
717
  #
678
718
  # 目次データを取得する
679
719
  #
680
- def get_latest_table_of_contents
720
+ def get_latest_table_of_contents(old_toc, through_error: false)
681
721
  toc_source = Downloader.get_toc_source(@setting)
682
722
  return nil unless toc_source
683
723
  @setting.multi_match(toc_source, "tcode")
@@ -704,11 +744,13 @@ class Downloader
704
744
  @setting["title"] = get_title
705
745
  if series_novel?
706
746
  # 連載小説
707
- subtitles = get_subtitles(toc_source)
747
+ subtitles = get_subtitles(toc_source, old_toc)
708
748
  else
709
749
  # 短編小説
710
750
  subtitles = create_short_story_subtitles(info)
711
751
  end
752
+ @setting["subtitles"] = subtitles
753
+
712
754
  toc_objects = {
713
755
  "title" => get_title,
714
756
  "author" => @setting["author"],
@@ -718,6 +760,7 @@ class Downloader
718
760
  }
719
761
  toc_objects
720
762
  rescue OpenURI::HTTPError, Errno::ECONNRESET => e
763
+ raise if through_error # エラー処理はしなくていいからそのまま例外を受け取りたい時用
721
764
  if e.message.include?("404")
722
765
  error "小説が削除されているか非公開な可能性があります"
723
766
  if @@database.novel_exists?(@id)
@@ -763,7 +806,7 @@ class Downloader
763
806
  next true
764
807
  end
765
808
  # 更新日チェック
766
- # subdate : 初稿投稿日(Arcadiaでは改稿日)
809
+ # subdate : 初稿投稿日
767
810
  # subupdate : 改稿日
768
811
  old_subdate = old["subdate"]
769
812
  latest_subdate = latest["subdate"]
@@ -826,21 +869,34 @@ class Downloader
826
869
  #
827
870
  # 各話の情報を取得
828
871
  #
829
- def get_subtitles(toc_source)
872
+ def get_subtitles(toc_source, old_toc)
830
873
  subtitles = []
831
874
  toc_post = toc_source.dup
875
+ old_subtitles = old_toc ? old_toc["subtitles"] : nil
832
876
  loop do
833
877
  match_data = @setting.multi_match(toc_post, "subtitles")
834
878
  break unless match_data
835
879
  toc_post = match_data.post_match
836
880
  @setting["subtitle"] = @setting["subtitle"].gsub("\t", "")
881
+ subdate = @setting["subdate"].tap { |sd|
882
+ # subdate(初回掲載日)がない場合、最初に取得した時のsubupdateで代用する
883
+ # subdateが取得出来ないのは暁とArcadia
884
+ unless sd
885
+ old_index = old_subtitles ? __search_index_in_subtitles(old_subtitles, @setting["index"]) : nil
886
+ if !old_index || !old_subtitles[old_index]["subdate"]
887
+ break @setting["subupdate"]
888
+ end
889
+ # || 以降は subupdate を取得していない古い(2.4.0以前)toc.yamlがあるためsubdateを使う
890
+ break old_subtitles[old_index]["subupdate"] || old_subtitles[old_index]["subdate"]
891
+ end
892
+ }
837
893
  subtitles << {
838
894
  "index" => @setting["index"],
839
895
  "href" => @setting["href"],
840
896
  "chapter" => @setting["chapter"],
841
897
  "subtitle" => @setting["subtitle"].gsub("\n", ""),
842
898
  "file_subtitle" => Helper.replace_filename_special_chars(@setting["subtitle"]),
843
- "subdate" => @setting["subdate"],
899
+ "subdate" => subdate,
844
900
  "subupdate" => @setting["subupdate"]
845
901
  }
846
902
  end
data/lib/helper.rb CHANGED
@@ -257,6 +257,13 @@ module Helper
257
257
  end
258
258
  end
259
259
 
260
+ #
261
+ # 日付形式の文字列をTime型に変換する
262
+ #
263
+ def date_string_to_time(date)
264
+ date ? Time.parse(date.sub(/[\((].+?[\))]/, "").tr("年月日時分秒", "///:::")) : nil
265
+ end
266
+
260
267
  #
261
268
  # 外部コマンド実行中の待機ループの処理を書けるクラス
262
269
  #
data/lib/novelinfo.rb CHANGED
@@ -35,8 +35,10 @@ class NovelInfo
35
35
  of = "t-nt-ga-s-gf-nu-gl-w"
36
36
  request_output_parameters = of.split("-")
37
37
  info_source = ""
38
- open(info_url) do |fp|
38
+ cookie = @setting["cookie"] || ""
39
+ open(info_url, "Cookie" => cookie) do |fp|
39
40
  info_source = Helper.pretreatment_source(fp.read, @setting["encoding"])
41
+ raise Downloader::DownloaderNotFoundError if Downloader.detect_error_message(@setting, info_source)
40
42
  end
41
43
  @setting.multi_match(info_source, *request_output_parameters)
42
44
  result["last_load_time"] = Time.now
@@ -54,15 +56,11 @@ class NovelInfo
54
56
  result["story"] = HTML.new(@setting["story"]).to_aozora
55
57
  result["writer"] = @setting["writer"]
56
58
  %w(general_firstup novelupdated_at general_lastup).each do |elm|
57
- result[elm] = date_string_to_time(@setting[elm])
59
+ result[elm] = Helper.date_string_to_time(@setting[elm])
58
60
  end
59
61
  result["novelupdated_at"] ||= result["general_firstup"]
60
62
  result["general_lastup"] ||= result["novelupdated_at"]
61
63
 
62
64
  result
63
65
  end
64
-
65
- def date_string_to_time(date)
66
- date ? Time.parse(date.sub(/[\((].+?[\))]/, "").tr("年月日時分秒", "///:::")) : nil
67
- end
68
66
  end
data/lib/version.rb CHANGED
@@ -3,5 +3,5 @@
3
3
  # Copyright 2013 whiteleaf. All rights reserved.
4
4
  #
5
5
 
6
- Version = "2.4.0"
6
+ Version = "2.4.1"
7
7
 
data/lib/web/appserver.rb CHANGED
@@ -573,6 +573,13 @@ class Narou::AppServer < Sinatra::Base
573
573
  json res
574
574
  end
575
575
 
576
+ post "/api/update_general_lastup" do
577
+ Narou::Worker.push do
578
+ CommandLine.run!(["update", "--gl"])
579
+ end
580
+ end
581
+
582
+
576
583
  get "/js/widget.js" do
577
584
  if %w(download).include?(params["mode"])
578
585
  content_type :js
@@ -348,6 +348,45 @@ var Narou = (function() {
348
348
  }
349
349
  },
350
350
 
351
+ updateView: function() {
352
+ var self = this;
353
+ var ids = [];
354
+ $("#novel-list tbody tr").each(function(i, tr) {
355
+ var data = self.table.row(tr).data();
356
+ if (data) {
357
+ ids.push(data.id);
358
+ }
359
+ });
360
+ if (ids.length > 0) {
361
+ $.post("/api/update_select", { "ids": ids });
362
+ console.log("updating " + ids.join(", "));
363
+ }
364
+ },
365
+
366
+ updateGeneralLastup: function() {
367
+ bootbox.dialog({
368
+ title: '最新話掲載日の更新',
369
+ message: "凍結済みを除く各小説の最新話掲載日を更新します。<br>" +
370
+ "最新話掲載日は通常時のUPDATEでも更新されるので、手動で更新する必要は基本的にはありません。<br>" +
371
+ "掲載日だけを調べて、選択的にUPDATEをかけるなど、用途を理解した上で小説サイトのサーバーに負荷をかけない範囲でご利用下さい。",
372
+ backdrop: true,
373
+ buttons: {
374
+ cancel: {
375
+ label: "キャンセル",
376
+ className: "btn-default",
377
+ },
378
+ main: {
379
+ label: "更新する",
380
+ className: "btn-primary",
381
+ callback: function() {
382
+ $.post("/api/update_general_lastup");
383
+ console.log("updating general lastup");
384
+ }
385
+ },
386
+ }
387
+ });
388
+ },
389
+
351
390
  send: function() {
352
391
  var ids = this._getSelectedIds(arguments);
353
392
  if (ids.length === 0) {
@@ -707,7 +746,8 @@ var Narou = (function() {
707
746
  $target.on("click", ".tag", args, function(e) {
708
747
  if (e.data.stop_bubbling) e.stopPropagation();
709
748
  var tag_name = $(this).data("tag");
710
- self.table.column("tags:name").search(tag_name).draw();
749
+ $("#tag-search").val(tag_name);
750
+ self.table.draw();
711
751
  }).on("mousedown", ".tag", args, function(e) {
712
752
  // 範囲選択モードでもクリック出来るように
713
753
  if (e.data.stop_bubbling) e.stopPropagation();
@@ -41,11 +41,24 @@ $(document).ready(function() {
41
41
  });
42
42
  });
43
43
 
44
+ /*
45
+ * タグ検索
46
+ */
47
+ var $tag_search = $("#tag-search");
48
+ $.fn.dataTable.ext.search.push(function (settings, data, dataIndex) {
49
+ var tag_name = $tag_search.val();
50
+ if (tag_name.length == 0) return true;
51
+ var tags = table.row(dataIndex).data().tags;
52
+ return tags.match(new RegExp('data-tag="' + tag_name + '"'));
53
+ });
54
+
55
+
44
56
  var ANNOTATION_COLOR_TIME_LIMIT = 6 * 60 * 60; // 6時間(秒)
45
57
  var GENERAL_LASTUP_CLASSES = [
46
58
  [60 * 60, "gl-60minutes"],
47
59
  [6 * 60 * 60, "gl-6hour"],
48
60
  [24 * 60 * 60, "gl-24hour"],
61
+ [3 * 24 * 60 * 60, "gl-3days"],
49
62
  [7 * 24 * 60 * 60, "gl-1week"],
50
63
  [-1, "gl-other"]
51
64
  ];
@@ -121,6 +134,9 @@ $(document).ready(function() {
121
134
  }
122
135
  return '<span class="general-lastup ' + klass + '">' + display + '</span>';
123
136
  }
137
+ else if (type === "sort") {
138
+ return data * 10000 + (row.id | 0);
139
+ }
124
140
  return data;
125
141
  }
126
142
  },
@@ -885,6 +901,24 @@ $(document).ready(function() {
885
901
  action.update();
886
902
  });
887
903
 
904
+ /*
905
+ * ボタン
906
+ * Update > 表示されている小説を更新
907
+ */
908
+ $("#button-update-view").on("click", function(e) {
909
+ e.preventDefault();
910
+ action.updateView();
911
+ });
912
+
913
+ /*
914
+ * ボタン
915
+ * Update > 最新話掲載日を更新
916
+ */
917
+ $("#button-update-general-lastup").on("click", function(e) {
918
+ e.preventDefault();
919
+ action.updateGeneralLastup();
920
+ });
921
+
888
922
  /*
889
923
  * ボタン
890
924
  * Send
@@ -149,6 +149,14 @@
149
149
  %a#button-download-force(href="#") 選択した小説を強制再ダウンロード
150
150
  .btn-group
151
151
  %button#button-update.btn.btn-success(type="button") Update
152
+ %button.btn.btn-success.dropdown-toggle(type="button" data-toggle="dropdown")
153
+ %span.caret
154
+ %span.sr-only Toggle Dropdown
155
+ %ul.dropdown-menu(role="menu")
156
+ %li
157
+ %a#button-update-view(href="#") 表示されている小説を更新
158
+ %li
159
+ %a#button-update-general-lastup(href="#") 最新話掲載日を更新
152
160
  .btn-group
153
161
  %button#button-send.btn.btn-warning(type="button") Send
154
162
  .btn-group
@@ -188,6 +196,8 @@
188
196
  %li
189
197
  %a#button-backup(href="#") 選択した小説のバックアップを作成(backup)
190
198
 
199
+ %input#tag-search(type="text")
200
+
191
201
  -# 小説の一覧テーブル
192
202
  %div
193
203
  %table#novel-list.dataTable.table.table-bordered(cellspacing="0" width="100%")
@@ -248,13 +248,27 @@ table#novel-list {
248
248
  color: white;
249
249
  border-radius: 4px;
250
250
  }
251
+ }
252
+ /* 3日以内 */
253
+ .gl-3days {
254
+ &::after {
255
+ content: "3d";
256
+ color: darken(gray, 15%);
257
+ background-color: lighten(mix(gray, blue, 70%), 40%);
258
+
259
+ position: relative;
260
+ left: 4px;
261
+ padding: 1px 2px 1px 2px;
262
+ font-size: 90%;
263
+ border-radius: 4px;
264
+ }
251
265
  }
252
266
  /* 1週間以内 */
253
267
  .gl-1week {
254
268
  &::after {
255
269
  content: "1w";
256
270
  color: darken(gray, 15%);
257
- background-color: lighten(gray, 35%);
271
+ background-color: lighten(mix(blue, white, 30%), 50%);
258
272
 
259
273
  position: relative;
260
274
  left: 4px;
@@ -805,3 +819,8 @@ $console-color: white;
805
819
  }
806
820
  }
807
821
 
822
+ /* タグ検索用ボックス */
823
+ #tag-search {
824
+ display: none;
825
+ }
826
+
data/narou.gemspec CHANGED
@@ -32,33 +32,25 @@ Gem::Specification.new do |gem|
32
32
  install_message = <<-EOS
33
33
  #{"*" * 79}
34
34
 
35
- 2.4.0 : 2015/05/16
35
+ 2.4.1 : 2015/05/24
36
36
  ------------------
37
37
  #### 追加機能
38
- - WEB UI に保存フォルダを開くためのボタンを表示する項目「保存先」を追加しました
39
- - WEB UI に項目「最新話掲載日」を追加しました
40
- + 「小説家になろう」と「ハーメルン」のみ対応しています(updateした小説から
41
- 反映されていきます)。更新が無いと反映されないため、手動で反映させたい場合
42
- はWEB UI サーバを落とした状態で `narou u --gl` コマンドを使用して下さい。
43
- (基本的に一度実行するだけで十分です)
38
+ - WEB UI の Update ボタンに「表示されている小説を更新」、「最新話掲載日を更新」
39
+ という選択肢を追加しました
40
+ + 表示されている小説を更新:見える範囲内の小説を選択せずに更新出来る。タグ検
41
+ 索やフィルターで絞り込んだあとにいちいち選択する必要がなくなる
42
+ + 最新話掲載日を更新: `narou u --gl` を WEB UI からも実行出来るようにした物
44
43
 
45
44
  #### 仕様変更
46
- - 小説リストの「新着」及び「更新」の表示基準を調整しました
47
- - replace.txt による置換を行うタイミングを変更しました
48
- + 今までは (before→本体処理→after)*話数分→置換 という処理順だったものが、
49
- (before→本体処理→after→置換)*話数分 という処理順になりました
45
+ - WEB UI の項目「最新話掲載日」をArcadia及び暁にも対応させました
46
+ + それに伴い `narou u --gl` コマンドもArcadiaと暁に対応します
47
+ - `narou u --gl` コマンドが凍結済み小説は無視するように変更しました
48
+ - 最新話掲載日の経過日時表記に「3d」(3日以内に掲載)を追加しました
50
49
 
51
50
  #### Bug Fix
52
- - `enable_insert_word_separator` を有効にした場合に発生する以下の不具合を修正
53
- + 開きカッコの禁則処理が Kindle で処理されなくなる
54
- + replace.txt による置換が正常に行われない場合がある
55
- + URLが含まれている文章の単語分割が正常に行われない
56
- - あらすじだけ更新された場合にデータベースが更新されていなかった不具合を修正
57
- - 小説サイトのサーバーがダウンしている時にエラーがでる問題を修正
58
- - WEB UI の小説リストにおいて、更新・新着の表示期間が過ぎているにも関わらず、
59
- アップデート等をした際に消えない不具合を修正
60
- - ハーメルンで非公開になっている小説をアップデートするとエラーになる不具合
61
- を修正
51
+ - WEB UI のタグ検索が部分一致になっていたのを完全一致に修正しました
52
+ - 連続したミュートが正しく変換できていなかったのを修正
53
+
62
54
 
63
55
  #{"*" * 79}
64
56
  EOS
@@ -2,6 +2,7 @@ test_auto_indent
2
2
  whiteleaf
3
3
 
4
4
  [#改ページ]
5
+
5
6
  [#3字下げ][#中見出し]オートインデントテスト[#中見出し終わり]
6
7
 
7
8
 
@@ -2,6 +2,7 @@ test_auto_join_bracket
2
2
  whiteleaf
3
3
 
4
4
  [#改ページ]
5
+
5
6
  [#3字下げ][#中見出し]カギ括弧連結テスト[#中見出し終わり]
6
7
 
7
8
 
@@ -2,6 +2,7 @@ test_auto_join_line
2
2
  whiteleaf
3
3
 
4
4
  [#改ページ]
5
+
5
6
  [#3字下げ][#中見出し]作者による折り返しを強制連結テスト[#中見出し終わり]
6
7
 
7
8
 
@@ -2,6 +2,7 @@ test_convert_page_break
2
2
  whiteleaf
3
3
 
4
4
  [#改ページ]
5
+
5
6
  [#3字下げ][#中見出し]改ページ変換テスト[#中見出し終わり]
6
7
 
7
8
 
@@ -2,6 +2,7 @@ test_english
2
2
  whiteleaf
3
3
 
4
4
  [#改ページ]
5
+
5
6
  [#3字下げ][#中見出し]アルファベット全角化&英文テスト[#中見出し終わり]
6
7
 
7
8
 
@@ -2,6 +2,7 @@ test_horizontal_ellipsis
2
2
  whiteleaf
3
3
 
4
4
  [#改ページ]
5
+
5
6
  [#3字下げ][#中見出し]三点リーダー化テスト[#中見出し終わり]
6
7
 
7
8
 
@@ -2,6 +2,7 @@ test_insert_separator
2
2
  whiteleaf
3
3
 
4
4
  [#改ページ]
5
+
5
6
  [#3字下げ][#中見出し][#zws]単語分割[#zws]の[#zws]テスト[#zws][#中見出し終わり]
6
7
 
7
8
 
@@ -2,6 +2,7 @@ test_insert_separator_and_replace_txt
2
2
  whiteleaf
3
3
 
4
4
  [#改ページ]
5
+
5
6
  [#3字下げ][#中見出し][#zws]単語分割[#zws]をしつつ[#zws]置換[#zws]する[#zws]テスト[#zws][#中見出し終わり]
6
7
 
7
8
 
@@ -2,6 +2,7 @@ test_kanji_num
2
2
  whiteleaf
3
3
 
4
4
  [#改ページ]
5
+
5
6
  [#3字下げ][#中見出し]漢数字化テスト[#中見出し終わり]
6
7
 
7
8
 
@@ -2,6 +2,7 @@ test_nonokagi
2
2
  whiteleaf
3
3
 
4
4
  [#改ページ]
5
+
5
6
  [#3字下げ][#中見出し]ノノカギテスト[#中見出し終わり]
6
7
 
7
8
 
@@ -2,6 +2,7 @@ test_replace
2
2
  whiteleaf
3
3
 
4
4
  [#改ページ]
5
+
5
6
  [#3字下げ][#中見出し]replace.txtテスト[#中見出し終わり]
6
7
 
7
8
 
@@ -2,6 +2,7 @@ test_ruby
2
2
  whiteleaf
3
3
 
4
4
  [#改ページ]
5
+
5
6
  [#3字下げ][#中見出し]ルビテスト[#中見出し終わり]
6
7
 
7
8
 
@@ -2,6 +2,7 @@ test_ruby_youon
2
2
  whiteleaf
3
3
 
4
4
  [#改ページ]
5
+
5
6
  [#3字下げ][#中見出し]拗音巨大化テスト[#中見出し終わり]
6
7
 
7
8
 
@@ -2,6 +2,7 @@ test_sesame
2
2
  whiteleaf
3
3
 
4
4
  [#改ページ]
5
+
5
6
  [#3字下げ][#中見出し]傍点テスト[#中見出し終わり]
6
7
 
7
8
 
@@ -2,6 +2,7 @@ test_to_odd_leader
2
2
  whiteleaf
3
3
 
4
4
  [#改ページ]
5
+
5
6
  [#3字下げ][#中見出し]三点リーダー偶数化テスト[#中見出し終わり]
6
7
 
7
8
 
data/spec/helper_spec.rb CHANGED
@@ -69,4 +69,14 @@ describe Helper do
69
69
  it { expect(Helper.string_cast_to_type("string", :string)).to eq "string" }
70
70
  end
71
71
  end
72
+
73
+ describe ".date_string_to_time" do
74
+ it do
75
+ expect(Helper.date_string_to_time("2014年03月02日(日) 07:39")).to eq(Time.parse("2014/3/2 07:39"))
76
+ end
77
+
78
+ it do
79
+ expect(Helper.date_string_to_time("2012年 11月22日 17時00分")).to eq(Time.parse("2012/11/22 17:00"))
80
+ end
81
+ end
72
82
  end
@@ -12,9 +12,4 @@ describe NovelInfo do
12
12
  }
13
13
  @novelinfo = NovelInfo.new(setting)
14
14
  end
15
-
16
- it "#date_string_to_time" do
17
- expect(@novelinfo.date_string_to_time("2014年03月02日(日) 07:39")).to eq(Time.parse("2014/3/2 07:39"))
18
- expect(@novelinfo.date_string_to_time("2012年 11月22日 17時00分")).to eq(Time.parse("2012/11/22 17:00"))
19
- end
20
15
  end
@@ -18,7 +18,7 @@ subtitles: |-
18
18
 
19
19
  href: \\k<index>.html
20
20
 
21
- error_message: 投稿者が削除、もしくは間違ったアドレスを指定しています|この作品は完全非公開設定です
21
+ error_message: 投稿者が削除、もしくは間違ったアドレスを指定しています|この作品は投稿者によって削除されました|この作品は完全非公開設定です|この小説は非公開設定になっています
22
22
 
23
23
  # ------------------------------------------------------------
24
24
  # 本文取得設定
@@ -22,9 +22,10 @@ story: |-
22
22
  # 目次取得設定
23
23
  toc_url: \\k<top_url>/stories/index/novel_id~\\k<ncode>
24
24
  subtitles: |-
25
- (?:<tr><td style="border: 0; padding: 0;word-break:break-all;" colspan=\\"2\\"><b>(?<chapter>.+?)</b></td></tr>)*<tr><td>( )?<a href="(?<href>/stories/view/(?<index>\d+)/novel_id\~\d+)">(?<subtitle>.+?)</a> </td><td class="font-s">(?<subdate>.+?) </td></tr>
25
+ (?:<tr><td style="border: 0; padding: 0;word-break:break-all;" colspan=\\"2\\"><b>(?<chapter>.+?)</b></td></tr>)*<tr><td>( )?<a href="(?<href>/stories/view/(?<index>\d+)/novel_id\~\d+)">(?<subtitle>.+?)</a> </td><td class="font-s">(?<subupdate>.+?) </td></tr>
26
26
 
27
- subupdate: no
27
+ # subdate(初投稿日)がない場合、一番最初のsubupdateで代用する
28
+ subdate: no
28
29
 
29
30
  error_message: この小説は作者の諸事情により非公開にしています
30
31
 
@@ -22,10 +22,10 @@ toc_url: \\k<top_url>/bbs/sst/sst.php?act=dump&cate=\\k<category>&all=\\k<ncode>
22
22
  chapter: ""
23
23
  subtitles: |-
24
24
  <td width="0%" style="font-size:60%">\[(?<index>\d+?)\]</td><td width="0%" style="font-size:60%"><b>
25
- <a href="(?<href>.+?)#kiji">(?<subtitle>.+?)</a></b></td><td width="0%" style="font-size:60%">\[(.+?)\]</td><td width="0%" style="font-size:60%">\((?<subdate>.+?)\)</td>
25
+ <a href="(?<href>.+?)#kiji">(?<subtitle>.+?)</a></b></td><td width="0%" style="font-size:60%">\[(.+?)\]</td><td width="0%" style="font-size:60%">\((?<subupdate>.+?)\)</td>
26
26
 
27
- # subupdate がない場合、更新チェックは subdate を使うようになる
28
- subupdate: no
27
+ # subdate(初投稿日)がない場合、一番最初のsubupdateで代用する
28
+ subdate: no
29
29
 
30
30
  error_message: エラー!恐らく存在しないスレッドを指定しています
31
31
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: narou
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.0
4
+ version: 2.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - whiteleaf7
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-16 00:00:00.000000000 Z
11
+ date: 2015-05-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: termcolorlight
@@ -415,33 +415,25 @@ metadata: {}
415
415
  post_install_message: |
416
416
  *******************************************************************************
417
417
 
418
- 2.4.0 : 2015/05/16
418
+ 2.4.1 : 2015/05/24
419
419
  ------------------
420
420
  #### 追加機能
421
- - WEB UI に保存フォルダを開くためのボタンを表示する項目「保存先」を追加しました
422
- - WEB UI に項目「最新話掲載日」を追加しました
423
- + 「小説家になろう」と「ハーメルン」のみ対応しています(updateした小説から
424
- 反映されていきます)。更新が無いと反映されないため、手動で反映させたい場合
425
- はWEB UI サーバを落とした状態で `narou u --gl` コマンドを使用して下さい。
426
- (基本的に一度実行するだけで十分です)
421
+ - WEB UI の Update ボタンに「表示されている小説を更新」、「最新話掲載日を更新」
422
+ という選択肢を追加しました
423
+ + 表示されている小説を更新:見える範囲内の小説を選択せずに更新出来る。タグ検
424
+ 索やフィルターで絞り込んだあとにいちいち選択する必要がなくなる
425
+ + 最新話掲載日を更新: `narou u --gl` を WEB UI からも実行出来るようにした物
427
426
 
428
427
  #### 仕様変更
429
- - 小説リストの「新着」及び「更新」の表示基準を調整しました
430
- - replace.txt による置換を行うタイミングを変更しました
431
- + 今までは (before→本体処理→after)*話数分→置換 という処理順だったものが、
432
- (before→本体処理→after→置換)*話数分 という処理順になりました
428
+ - WEB UI の項目「最新話掲載日」をArcadia及び暁にも対応させました
429
+ + それに伴い `narou u --gl` コマンドもArcadiaと暁に対応します
430
+ - `narou u --gl` コマンドが凍結済み小説は無視するように変更しました
431
+ - 最新話掲載日の経過日時表記に「3d」(3日以内に掲載)を追加しました
433
432
 
434
433
  #### Bug Fix
435
- - `enable_insert_word_separator` を有効にした場合に発生する以下の不具合を修正
436
- + 開きカッコの禁則処理が Kindle で処理されなくなる
437
- + replace.txt による置換が正常に行われない場合がある
438
- + URLが含まれている文章の単語分割が正常に行われない
439
- - あらすじだけ更新された場合にデータベースが更新されていなかった不具合を修正
440
- - 小説サイトのサーバーがダウンしている時にエラーがでる問題を修正
441
- - WEB UI の小説リストにおいて、更新・新着の表示期間が過ぎているにも関わらず、
442
- アップデート等をした際に消えない不具合を修正
443
- - ハーメルンで非公開になっている小説をアップデートするとエラーになる不具合
444
- を修正
434
+ - WEB UI のタグ検索が部分一致になっていたのを完全一致に修正しました
435
+ - 連続したミュートが正しく変換できていなかったのを修正
436
+
445
437
 
446
438
  *******************************************************************************
447
439
  rdoc_options: []