• R/O
  • HTTP
  • SSH
  • HTTPS

feedblog_ext: Commit

JavaScriptのみで記述されたブログツール・ソフトウェアです。表示にExt JSを使用します


Commit MetaInfo

Revision626812038a7de3bc0f9f409b7998ef9c40fb5003 (tree)
Time2009-06-06 14:15:51
Authorelixirel <elixirel@user...>
Commiterelixirel

Log Message

add allRemoveFunction and modified after delete index.

Change Summary

Incremental Difference

--- a/generator.html
+++ b/generator.html
@@ -187,7 +187,7 @@
187187 </tbody>
188188 </table>
189189 <br>
190- <input type="button" value="追加/編集" onclick="javascript:applyChange();"> <input type="button" value="選択中の記事を削除" onclick="javascript:removeEntry()">  <input type="button" value="リセット" onclick="javascript:initLoad()"
190+ <input type="button" value="追加/編集" onclick="javascript:applyChange();"> <input type="button" value="選択中の記事を削除" onclick="javascript:removeEntry()">  <input type="button" value="リセット" onclick="javascript:initLoad()">  <input type="button" value="全記事を削除" onclick="javascript:allRemoveEntry()">
191191 <br>
192192 <br>
193193 </td>
--- a/js/lunardial/feedblog_gen.js
+++ b/js/lunardial/feedblog_gen.js
@@ -31,6 +31,12 @@ function applyChange(){
3131 feedInfo = applyFeedinfo();
3232 pageAddr = feedInfo.alternate;
3333
34+ if (document.getElementById("entry_title").value == "" || document.getElementById("entry_stdin").value == "") {
35+ if (confirm("タイトルか記事が空白です!FeedBlogでの表示時にエラーが出ますがよろしいですか?") == false) {
36+ return;
37+ }
38+ }
39+
3440 if (editIndex < 0) {
3541 var entry = new Object();
3642 var dateRfc3339 = getDate();
@@ -43,7 +49,12 @@ function applyChange(){
4349 entry.content = document.getElementById("entry_stdin").value.replace(/\r\n/g, "\n");
4450 entryList.unshift(entry);
4551
52+ // ログ一覧を更新する
4653 refleshEntrylistBox();
54+
55+ // 更新後、選択されている項目を、先刻追加した日記に移動する
56+ document.getElementById("logBox").selectedIndex = 1;
57+ editIndex = 0;
4758 }
4859 else {
4960 entryList[editIndex].title = document.getElementById("entry_title").value;
@@ -59,8 +70,8 @@ function applyChange(){
5970 * @param {int} index entryListから削除される記事のインデックス
6071 */
6172 function removeEntry(index){
62- if (editIndex >= 0) {
63- entryList.splice(index, 1);
73+ if (editIndex == 0) {
74+ entryList.splice(editIndex, 1);
6475 refleshEntrylistBox();
6576 editIndex = -1;
6677
@@ -68,6 +79,29 @@ function removeEntry(index){
6879 document.getElementById("entry_title").value = "";
6980 document.getElementById("entry_stdin").value = "";
7081 }
82+ if (editIndex > 0) {
83+ var prevIndex = document.getElementById("logBox").selectedIndex - 1;
84+ entryList.splice(editIndex, 1);
85+ refleshEntrylistBox();
86+ document.getElementById("logBox").selectedIndex = prevIndex;
87+ editIndex = editIndex - 1;
88+
89+ entryLoader(editIndex);
90+ }
91+}
92+
93+/**
94+ * すべての記事を削除します
95+ */
96+function allRemoveEntry(){
97+ entryList = [];
98+
99+ editIndex = -1;
100+ refleshEntrylistBox();
101+
102+ document.getElementById("stdout").value = ""
103+ document.getElementById("entry_title").value = "";
104+ document.getElementById("entry_stdin").value = "";
71105 }
72106
73107 /**
@@ -213,7 +247,7 @@ function entryLoader(index){
213247 */
214248 function refleshEntrylistBox(){
215249 var stringBuffer = [];
216- stringBuffer.push("<form name='logform'><select name='logbox' style='width: " + comboWidth + "px' onchange='entryLoader(this.options[this.selectedIndex].value)'>");
250+ stringBuffer.push("<form name='logform'><select id='logBox' style='width: " + comboWidth + "px' onchange='entryLoader(this.options[this.selectedIndex].value)'>");
217251 stringBuffer.push("<option value='-1'>新規作成</option>");
218252 for (var i = 0; i < entryList.length; i++) {
219253 stringBuffer.push("<option value='" + i + "'/>" + entryList[i].title + "</option>");
Show on old repository browser