• R/O
  • HTTP
  • SSH
  • HTTPS

feedblog_ext: Commit

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


Commit MetaInfo

Revision1a29dade69b10a27a4b35e9358df1a28696e5736 (tree)
Time2009-06-03 23:44:20
Authorelixirel <elixirel@user...>
Commiterelixirel

Log Message

creating save(generator.html and feedblog_gen.js).

Change Summary

Incremental Difference

--- /dev/null
+++ b/generator.html
@@ -0,0 +1,76 @@
1+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2+<html>
3+ <head>
4+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5+ <title>日記設置サンプル</title>
6+ <link rel="stylesheet" href="./js/ext/resources/css/ext-all.css" type="text/css"/>
7+ <link rel="alternate" type="application/atom+xml" title="Atom" href="./xml/diary.xml"/>
8+ <script type="text/javascript" src="./js/lunardial/feedblog_gen.js"></script>
9+ <style type="text/css">
10+ body {
11+ font-size: 12px;
12+ line-height: 18px;
13+ color: #004488;
14+ margin-top: 30px;
15+ margin-bottom: 30px;
16+ }
17+
18+ td.default {
19+ font-size: 12px;
20+ line-height: 18px;
21+ color: #004488;
22+ border: 1px solid #8888ff;
23+ text-align: left;
24+ vertical-align: top;
25+ }
26+
27+ div {
28+ text-align: left;
29+ }
30+
31+ div.code {
32+ background: #f8f8ff;
33+ border: 1px solid #c8c8ff;
34+ padding: 10px;
35+ margin: 10px;
36+ margin-left: 0px;
37+ border-left: 5px solid #e8e8ff;
38+ font-size: 12px;
39+ line-height: 18px;
40+ }
41+
42+ table.pager {
43+ padding: 0px;
44+ margin: 0px;
45+ border: 1px solid #8888ff;
46+ }
47+
48+ td.pager {
49+ border: 1px solid #8888ff;
50+ padding-left: 3px;
51+ }
52+ </style>
53+ </head>
54+ <body>
55+ <center>
56+ <table align="center" style="width: 800px;">
57+ <tbody>
58+ <tr>
59+ <td class="default" colspan="2" style="padding: 5px; text-align: center; vertical-align: bottom;">
60+ <input type="text" id="title">
61+ <br>
62+ <textarea id="content"></textarea>
63+ <br>
64+ <input type="button" value="CONVERT" onclick="javascript:convert();">
65+ </td>
66+ </tr>
67+ <tr>
68+ <td class="default" colspan="2" style="padding: 5px; text-align: center; vertical-align: bottom;">
69+ <div id="drawArea"></div>
70+ </td>
71+ </tr>
72+ </tbody>
73+ </table>
74+ </center>
75+ </body>
76+</html>
--- /dev/null
+++ b/js/lunardial/feedblog_gen.js
@@ -0,0 +1,54 @@
1+/**
2+ * FeedBlog Generator
3+ *
4+ * @copyright 2009 FeedBlog Project (http://sourceforge.jp/projects/feedblog/)
5+ * @author Kureha Hisame (http://lunardial.sakura.ne.jp/) & Yui Naruse (http://airemix.com/)
6+ * @since 2009/06/03
7+ * @version 0.1.0.0
8+ */
9+function convert(){
10+ var entry = new Object();
11+ entry.title = xmlAttrContentEscape(document.getElementById("title").value);
12+ entry.content = xmlAttrContentEscape(document.getElementById("content").value);
13+
14+ document.getElementById("drawArea").innerHTML = createEntry(entry.title, entry.content);
15+}
16+
17+
18+/**
19+ * 記事クラス
20+ * @param {Object} obj entry 要素の DOM オブジェクト
21+ */
22+function Entry(obj){
23+ this.title = $("title:first", obj).text();
24+ if (this.title == "")
25+ requiredElementError(obj, "title");
26+ this.title = "<span>" + validateText(this.title) + "</span>";
27+ this.content = $("content:first", obj).text();
28+ this.content = "<span>" + validateText(this.content) + "</span>";
29+ this.id = $("id:first", obj).text();
30+ if (this.id == "")
31+ requiredElementError(obj, "id");
32+ this.date = $("updated:first", obj).text();
33+ if (this.date == "")
34+ requiredElementError(obj, "updated");
35+ this.date = validateData(this.date);
36+}
37+
38+/**
39+ * XMLのエスケープを行う関数
40+ * @param {String} str エスケープを行う文字列
41+ */
42+function xmlAttrContentEscape(str){
43+ return str.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;');
44+}
45+
46+function createEntry(title, content){
47+ var stringBuffer = [];
48+ stringBuffer.push('<entry>');
49+ stringBuffer.push('<title>' + title + '</title>');
50+ stringBuffer.push('<content type="html">' + content + '</content>');
51+ stringBuffer.push('</entry>');
52+
53+ return xmlAttrContentEscape(stringBuffer.join("\n")).replace(/\n/g, "<br>");
54+}
Show on old repository browser