修訂 | 34856c2948ebec9a74fe63fd11328af6d4b0b33b (tree) |
---|---|
時間 | 2014-03-15 17:21:09 |
作者 | ![]() |
Commiter | Kureha Hisame |
- enhance tag search speed.
- change function names.
@@ -268,7 +268,7 @@ function executingEffect() { | ||
268 | 268 | /** |
269 | 269 | * 呼び出すとDIV:id名:feedblog_drawpanel_info上に、処理完了の記事を表示します |
270 | 270 | */ |
271 | -function executingEffectComplete() { | |
271 | +function executingEffectCompleteEffect() { | |
272 | 272 | $("#feedblog_drawpanel_info").html('<div id="feedblog_drawitem_info" class="feedblog_drawitem"> <\/div><\/div>'); |
273 | 273 | |
274 | 274 | // 検索処理完了用のパネルを生成 |
@@ -276,21 +276,32 @@ function executingEffectComplete() { | ||
276 | 276 | systemEntry.title = "検索完了"; |
277 | 277 | systemEntry.content = '<br/>検索処理が完了しました。(該当記事:' + fetchEntriesSemaphore.entryCount + '件)<br/><br/>'; |
278 | 278 | generateSystemPanel(systemEntry, "feedblog_drawitem_info", "feedblog_drawpanel_info", false); |
279 | +} | |
279 | 280 | |
280 | - // 状況に応じて「全件表示」パネルを生成 | |
281 | - if (fetchEntriesSemaphore.showLimit == true && fetchEntriesSemaphore.entryIndex != fetchEntriesSemaphore.entryCount) { | |
282 | - $("#feedblog_writearea").html($("#feedblog_writearea").html() + '<div id="feedblog_drawpanel_abort" class="feedblog_drawpanel"><div id="feedblog_drawitem_abort" class="feedblog_drawitem"> <\/div><\/div>'); | |
283 | - systemEntry = new SystemEntry(); | |
284 | - systemEntry.title = "以降、" + (fetchEntriesSemaphore.entryCount - fetchEntriesSemaphore.entryIndex) + "件の記事が省略されています。"; | |
285 | - systemEntry.content = '<br/><a style="cursor: pointer;" onclick="javascript: var tag = getParamFromUrl(\'tag\'); searchTagMode(tag, false);">全ての記事を表示する。</a><br/><br/>'; | |
286 | - generateSystemPanel(systemEntry, "feedblog_drawitem_abort", "feedblog_drawpanel_abort", false); | |
287 | - } | |
281 | +/** | |
282 | + * 呼び出すとDIV:id名:feedblog_drawpanel_abort上に、省略記事がある旨を描画します | |
283 | + */ | |
284 | +function showLimitedInfoEffect() { | |
285 | + $("#feedblog_writearea").html($("#feedblog_writearea").html() + '<div id="feedblog_drawpanel_abort" class="feedblog_drawpanel"><div id="feedblog_drawitem_abort" class="feedblog_drawitem"> <\/div><\/div>'); | |
286 | + | |
287 | + // 記事省略用のパネルを生成 | |
288 | + var systemEntry = new SystemEntry(); | |
289 | + systemEntry.title = "以降、" + (fetchEntriesSemaphore.entryCount - fetchEntriesSemaphore.entryIndex) + "件の記事が省略されています。"; | |
290 | + systemEntry.content = '<br/><a style="cursor: pointer;" onclick="javascript: fetchTagHiddenEntries();">全ての記事を表示する。</a><br/><br/>'; | |
291 | + generateSystemPanel(systemEntry, "feedblog_drawitem_abort", "feedblog_drawpanel_abort", false); | |
292 | +} | |
293 | + | |
294 | +/** | |
295 | + * 呼び出すとDIV:id名:feedblog_drawpanel_abortを消去します | |
296 | + */ | |
297 | +function showLimitedInfoRemoveEffect() { | |
298 | + $("#feedblog_drawpanel_abort").remove(); | |
288 | 299 | } |
289 | 300 | |
290 | 301 | /** |
291 | 302 | * 記事データのエラー時の処理を行います |
292 | 303 | */ |
293 | -function showError() { | |
304 | +function showErrorEffect() { | |
294 | 305 | $("#feedblog_writearea").html('<div id="feedblog_drawpanel" class="feedblog_drawpanel"><div id="feedblog_drawitem" class="feedblog_drawitem"> <\/div><\/div>'); |
295 | 306 | |
296 | 307 | // エラー内容をパネルに描画 |
@@ -312,7 +323,7 @@ function showError() { | ||
312 | 323 | /** |
313 | 324 | * 記事データのエラー時の処理を行います |
314 | 325 | */ |
315 | -function notFoundError() { | |
326 | +function notFoundErrorEffect() { | |
316 | 327 | $("#feedblog_writearea").html('<div id="feedblog_drawpanel" class="feedblog_drawpanel"><div id="feedblog_drawitem" class="feedblog_drawitem"> <\/div><\/div>'); |
317 | 328 | |
318 | 329 | // エラー内容をパネルに描画 |
@@ -427,7 +438,7 @@ function logXMLLoader() { | ||
427 | 438 | jQuery.ajax({ |
428 | 439 | url : logXmlUrl + '?time=' + urlSuffix, |
429 | 440 | method : "GET", |
430 | - error : showError, | |
441 | + error : showErrorEffect, | |
431 | 442 | success : function(xmlData) { |
432 | 443 | var separateTag = xmlData.getElementsByTagName("file"); |
433 | 444 |
@@ -473,7 +484,7 @@ function fullWriteMode(fileName) { | ||
473 | 484 | // 表示ロジック呼び出し |
474 | 485 | showEntriesRange(showLength, 0); |
475 | 486 | }, |
476 | - error : showError | |
487 | + error : showErrorEffect | |
477 | 488 | }); |
478 | 489 | } |
479 | 490 |
@@ -489,7 +500,7 @@ function searchHashMode(urlhash) { | ||
489 | 500 | var loader = new jQuery.ajax({ |
490 | 501 | url : logXmlUrl + '?time=' + urlSuffix, |
491 | 502 | method : "GET", |
492 | - error : showError, | |
503 | + error : showErrorEffect, | |
493 | 504 | success : function(xmlData) { |
494 | 505 | // ファイルパスの要素のみを抽出する |
495 | 506 | var separateTag = xmlData.getElementsByTagName("file"); |
@@ -558,7 +569,7 @@ function fetchHashEntries(xmlData) { | ||
558 | 569 | var entries = fetchEntriesSemaphore.buf; |
559 | 570 | |
560 | 571 | if (entries.length == 0) { |
561 | - notFoundError(); | |
572 | + notFoundErrorEffect(); | |
562 | 573 | return false; |
563 | 574 | } |
564 | 575 | } |
@@ -576,7 +587,7 @@ function searchIdMode(urlhash) { | ||
576 | 587 | var loader = new jQuery.ajax({ |
577 | 588 | url : logXmlUrl + '?time=' + urlSuffix, |
578 | 589 | method : "GET", |
579 | - error : showError, | |
590 | + error : showErrorEffect, | |
580 | 591 | success : function(xmlData) { |
581 | 592 | // ファイルパスの要素のみを抽出する |
582 | 593 | var separateTag = xmlData.getElementsByTagName("file"); |
@@ -646,7 +657,7 @@ function fetchIdEntries(xmlData) { | ||
646 | 657 | var entries = fetchEntriesSemaphore.buf; |
647 | 658 | |
648 | 659 | if (entries.length == 0) { |
649 | - notFoundError(); | |
660 | + notFoundErrorEffect(); | |
650 | 661 | return false; |
651 | 662 | } |
652 | 663 | } |
@@ -666,7 +677,7 @@ function searchTagMode(tag, showLimit) { | ||
666 | 677 | var loader = new jQuery.ajax({ |
667 | 678 | url : logXmlUrl + '?time=' + urlSuffix, |
668 | 679 | method : "GET", |
669 | - error : showError, | |
680 | + error : showErrorEffect, | |
670 | 681 | success : function(xmlData) { |
671 | 682 | // ファイルパスの要素のみを抽出する |
672 | 683 | var separateTag = xmlData.getElementsByTagName("file"); |
@@ -685,6 +696,7 @@ function searchTagMode(tag, showLimit) { | ||
685 | 696 | fetchEntriesSemaphore.entryIndex = 0; |
686 | 697 | fetchEntriesSemaphore.entryCount = 0; |
687 | 698 | fetchEntriesSemaphore.showLimit = showLimit; |
699 | + fetchEntriesSemaphore.hiddenEntries = []; | |
688 | 700 | |
689 | 701 | // ファイルパス配列に格納されているすべての記事に対し、探索を開始する |
690 | 702 | for (var i = 0; i < separateTag.length; i++) { |
@@ -725,6 +737,8 @@ function fetchTagEntries(xmlData) { | ||
725 | 737 | if (fetchEntriesSemaphore.showLimit == true && fetchEntriesSemaphore.entryIndex >= showLength) { |
726 | 738 | // 検索一致件数をカウント |
727 | 739 | fetchEntriesSemaphore.entryCount++; |
740 | + // entryを非表示配列に格納する | |
741 | + fetchEntriesSemaphore.hiddenEntries.push(entry); | |
728 | 742 | } else { |
729 | 743 | // 検索一致件数をカウント |
730 | 744 | fetchEntriesSemaphore.entryCount++; |
@@ -740,16 +754,33 @@ function fetchTagEntries(xmlData) { | ||
740 | 754 | |
741 | 755 | if (fetchEntriesSemaphore.count == 0) { |
742 | 756 | if (fetchEntriesSemaphore.entryIndex == 0) { |
743 | - notFoundError(); | |
757 | + notFoundErrorEffect(); | |
744 | 758 | return false; |
745 | 759 | } else { |
746 | - executingEffectComplete(); | |
760 | + executingEffectCompleteEffect(); | |
761 | + // 省略記事がある場合は、省略パネルを表示する | |
762 | + if (fetchEntriesSemaphore.entryIndex != fetchEntriesSemaphore.entryCount) { | |
763 | + showLimitedInfoEffect(); | |
764 | + } | |
747 | 765 | return true; |
748 | 766 | } |
749 | 767 | } |
750 | 768 | } |
751 | 769 | |
752 | 770 | /** |
771 | + * 省略表示されている記事一覧を描画します | |
772 | + */ | |
773 | +function fetchTagHiddenEntries() { | |
774 | + // 省略パネルを消去する | |
775 | + showLimitedInfoRemoveEffect(); | |
776 | + | |
777 | + // 省略されている記事を描画する | |
778 | + for (var i = 0; i < fetchEntriesSemaphore.hiddenEntries.length; i++) { | |
779 | + fetchEntriesSemaphore.entryIndex = showEntriesAdd(fetchEntriesSemaphore.hiddenEntries[i], fetchEntriesSemaphore.entryIndex); | |
780 | + } | |
781 | +} | |
782 | + | |
783 | +/** | |
753 | 784 | * 検索結果を分割して表示します |
754 | 785 | * class - div.feedblog_pager, ul.feedblog_pager, li.feedblog_pager などなど |
755 | 786 | * @param {int} showLength 一回の画面に表示する記事数 |
@@ -761,7 +792,7 @@ function showEntriesRange(showLength, startIndex) { | ||
761 | 792 | |
762 | 793 | // 表示インデックスが範囲外の場合はエラーパネルを表示して終了 |
763 | 794 | if (startIndex < 0 || (entries.length <= startIndex && entries.length != 0)) { |
764 | - showError(); | |
795 | + showErrorEffect(); | |
765 | 796 | return; |
766 | 797 | } |
767 | 798 |
@@ -252,7 +252,7 @@ function logXMLLoader() { | ||
252 | 252 | // 最新の日記をローディングする |
253 | 253 | xmlLoader(initUrl); |
254 | 254 | }, |
255 | - error : showError | |
255 | + error : showErrorEffect | |
256 | 256 | }); |
257 | 257 | } |
258 | 258 |
@@ -266,7 +266,7 @@ function xmlLoader(url) { | ||
266 | 266 | url : url + "?time=" + (+new Date()), |
267 | 267 | method : "GET", |
268 | 268 | success : analyzeTargetXml, |
269 | - error : showError | |
269 | + error : showErrorEffect | |
270 | 270 | }); |
271 | 271 | } |
272 | 272 |
@@ -520,7 +520,7 @@ function closePanel(id) { | ||
520 | 520 | /** |
521 | 521 | * エラー画面を表示します |
522 | 522 | */ |
523 | -function showError() { | |
523 | +function showErrorEffect() { | |
524 | 524 | alert("XMLファイルのローディング中にエラーが発生しました!"); |
525 | 525 | } |
526 | 526 |
@@ -293,7 +293,7 @@ function loadingEffect() { | ||
293 | 293 | /** |
294 | 294 | * 記事データのエラー時の処理を行います |
295 | 295 | */ |
296 | -function showError() { | |
296 | +function showErrorEffect() { | |
297 | 297 | $("#feedblog_writearea").html('<div id="feedblog_drawpanel" class="feedblog_drawpanel"><div id="feedblog_drawitem" class="feedblog_drawitem"> <\/div><\/div>'); |
298 | 298 | |
299 | 299 | // エラー内容をパネルに描画 |
@@ -315,7 +315,7 @@ function showError() { | ||
315 | 315 | /** |
316 | 316 | * 記事データのエラー時の処理を行います |
317 | 317 | */ |
318 | -function notFoundError() { | |
318 | +function notFoundErrorEffect() { | |
319 | 319 | $("#feedblog_writearea").html('<div id="feedblog_drawpanel" class="feedblog_drawpanel"><div id="feedblog_drawitem" class="feedblog_drawitem"> <\/div><\/div>'); |
320 | 320 | $("#feedblog_drawitem").html('<br/>検索条件に一致する記事は見つかりませんでした。<br/><br/>'); |
321 | 321 |
@@ -431,7 +431,7 @@ function logXMLLoader() { | ||
431 | 431 | jQuery.ajax({ |
432 | 432 | url : logXmlUrl + '?time=' + urlSuffix, |
433 | 433 | method : "GET", |
434 | - error : showError, | |
434 | + error : showErrorEffect, | |
435 | 435 | success : function(xmlData) { |
436 | 436 | var separateTag = xmlData.getElementsByTagName("file"); |
437 | 437 | logData = new Array(separateTag.length); |
@@ -526,7 +526,7 @@ function showEntriesRange(showLength, startIndex) { | ||
526 | 526 | |
527 | 527 | // 表示インデックスが範囲外の場合はエラーパネルを表示して終了 |
528 | 528 | if (startIndex < 0 || entries.length <= startIndex) { |
529 | - showError(); | |
529 | + showErrorEffect(); | |
530 | 530 | return; |
531 | 531 | } |
532 | 532 |
@@ -630,7 +630,7 @@ function fetchEntries(xmlData) { | ||
630 | 630 | |
631 | 631 | // 一軒も検索にヒットしなかった場合は専用のパネルを表示して終了 |
632 | 632 | if (entries.length == 0) { |
633 | - notFoundError(); | |
633 | + notFoundErrorEffect(); | |
634 | 634 | return; |
635 | 635 | } |
636 | 636 |
@@ -689,7 +689,7 @@ function searchDiary() { | ||
689 | 689 | method : "GET", |
690 | 690 | async : true, |
691 | 691 | success : fetchEntries, |
692 | - error : showError | |
692 | + error : showErrorEffect | |
693 | 693 | }); |
694 | 694 | fetchEntriesSemaphore.xhrs.push(xhr); |
695 | 695 | } |