• R/O
  • HTTP
  • SSH
  • HTTPS

feedblog_ext: Commit

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


Commit MetaInfo

Revisione96dd854a79c16a8a2137a879881d6a0531ec531 (tree)
Time2009-06-04 23:51:10
Authorelixirel <elixirel@user...>
Commiterelixirel

Log Message

fix many bug and use jwysiwyg.

Change Summary

Incremental Difference

--- a/generator.html
+++ b/generator.html
@@ -3,12 +3,19 @@
33 <head>
44 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
55 <title>日記設置サンプル</title>
6- <link rel="stylesheet" href="./js/ext/resources/css/ext-all.css" type="text/css"/>
6+ <link rel="stylesheet" href="./js/jwysiwyg/jquery.wysiwyg.css" type="text/css">
77 <link rel="alternate" type="application/atom+xml" title="Atom" href="./xml/diary.xml"/>
88 <script type="text/javascript" src="./js/jquery/jquery-1.3.2.min.js">
99 </script>
1010 <script type="text/javascript" src="./js/lunardial/feedblog_gen.js">
1111 </script>
12+ <script type="text/javascript" src="./js/jwysiwyg/jquery.wysiwyg.js">
13+ </script>
14+ <script type="text/javascript">
15+ $(function(){
16+ $('#stdin').wysiwyg();
17+ });
18+ </script>
1219 <style type="text/css">
1320 body {
1421 font-size: 12px;
@@ -65,7 +72,7 @@
6572 <br>
6673 <input type="text" id="title" style="width: 100%">
6774 <br>
68- <textarea id="content" rows="10" style="width: 100%">
75+ <textarea id="stdin" rows="10" style="width: 100%">
6976 </textarea>
7077 <br>
7178 <input type="button" value="CONVERT" onclick="javascript:applyChange();"><input type="button" value="DELETE" onclick="javascript:removeEntry()"><input type="button" value="RESET" onclick="javascript:initLoad()"
--- /dev/null
+++ b/js/jwysiwyg/jquery.wysiwyg.css
@@ -0,0 +1,57 @@
1+
2+div.wysiwyg { border: 1px solid #cccccc; padding: 5px; background-color: #ffffff; }
3+div.wysiwyg * { margin: 0; padding: 0; }
4+
5+div.wysiwyg ul.panel { border-bottom: 1px solid #cccccc; float: left; width: 100%; padding: 0 0 4px 0; }
6+div.wysiwyg ul.panel li { list-style-type: none; float: left; margin: 0 2px; background: #ffffff;}
7+div.wysiwyg ul.panel li.separator { height: 16px; margin: 0 4px; border-left: 1px solid #cccccc; }
8+div.wysiwyg ul.panel li a { opacity: 0.6; display: block; width: 16px; height: 16px; background: url('jquery.wysiwyg.gif') no-repeat -64px -80px; border: 0; cursor: pointer; padding: 1px; }
9+div.wysiwyg ul.panel li a:hover, div.wysiwyg ul.panel li a.active { opacity: 0.99; }
10+div.wysiwyg ul.panel li a.active { background-color: #f9f9f9; border: 1px solid #cccccc; border-left-color: #aaaaaa; border-top-color: #aaaaaa; padding: 0; }
11+
12+div.wysiwyg ul.panel li a.bold { background-position: 0 -16px; }
13+div.wysiwyg ul.panel li a.italic { background-position: -16px -16px; }
14+div.wysiwyg ul.panel li a.strikeThrough { background-position: -32px -16px; }
15+div.wysiwyg ul.panel li a.underline { background-position: -48px -16px; }
16+
17+div.wysiwyg ul.panel li a.justifyLeft { background-position: 0 0; }
18+div.wysiwyg ul.panel li a.justifyCenter { background-position: -16px 0; }
19+div.wysiwyg ul.panel li a.justifyRight { background-position: -32px 0; }
20+div.wysiwyg ul.panel li a.justifyFull { background-position: -48px 0; }
21+
22+div.wysiwyg ul.panel li a.indent { background-position: -64px 0; }
23+div.wysiwyg ul.panel li a.outdent { background-position: -80px 0; }
24+
25+div.wysiwyg ul.panel li a.subscript { background-position: -64px -16px; }
26+div.wysiwyg ul.panel li a.superscript { background-position: -80px -16px; }
27+
28+div.wysiwyg ul.panel li a.undo { background-position: 0 -64px; }
29+div.wysiwyg ul.panel li a.redo { background-position: -16px -64px; }
30+
31+div.wysiwyg ul.panel li a.insertOrderedList { background-position: -32px -48px; }
32+div.wysiwyg ul.panel li a.insertUnorderedList { background-position: -16px -48px; }
33+div.wysiwyg ul.panel li a.insertHorizontalRule { background-position: 0 -48px; }
34+
35+div.wysiwyg ul.panel li a.h1 { background-position: 0 -32px; }
36+div.wysiwyg ul.panel li a.h2 { background-position: -16px -32px; }
37+div.wysiwyg ul.panel li a.h3 { background-position: -32px -32px; }
38+div.wysiwyg ul.panel li a.h4 { background-position: -48px -32px; }
39+div.wysiwyg ul.panel li a.h5 { background-position: -64px -32px; }
40+div.wysiwyg ul.panel li a.h6 { background-position: -80px -32px; }
41+
42+div.wysiwyg ul.panel li a.cut { background-position: -32px -64px; }
43+div.wysiwyg ul.panel li a.copy { background-position: -48px -64px; }
44+div.wysiwyg ul.panel li a.paste { background-position: -64px -64px; }
45+
46+div.wysiwyg ul.panel li a.increaseFontSize { background-position: -16px -80px; }
47+div.wysiwyg ul.panel li a.decreaseFontSize { background-position: -32px -80px; }
48+
49+div.wysiwyg ul.panel li a.createLink { background-position: -80px -48px; }
50+div.wysiwyg ul.panel li a.insertImage { background-position: -80px -80px; }
51+
52+div.wysiwyg ul.panel li a.html { background-position: -48px -48px; }
53+div.wysiwyg ul.panel li a.removeFormat { background-position: -80px -64px; }
54+
55+div.wysiwyg ul.panel li a.empty { background-position: -64px -80px; }
56+
57+div.wysiwyg iframe { border: 0; margin: 5px 0 0 0; clear: left; }
\ No newline at end of file
Binary files /dev/null and b/js/jwysiwyg/jquery.wysiwyg.gif differ
--- /dev/null
+++ b/js/jwysiwyg/jquery.wysiwyg.js
@@ -0,0 +1,652 @@
1+/**
2+ * WYSIWYG - jQuery plugin 0.5
3+ *
4+ * Copyright (c) 2008-2009 Juan M Martinez
5+ * http://plugins.jquery.com/project/jWYSIWYG
6+ *
7+ * Dual licensed under the MIT and GPL licenses:
8+ * http://www.opensource.org/licenses/mit-license.php
9+ * http://www.gnu.org/licenses/gpl.html
10+ *
11+ * $Id: $
12+ */
13+(function( $ )
14+{
15+ $.fn.document = function()
16+ {
17+ var element = this[0];
18+
19+ if ( element.nodeName.toLowerCase() == 'iframe' )
20+ return element.contentWindow.document;
21+ /*
22+ return ( $.browser.msie )
23+ ? document.frames[element.id].document
24+ : element.contentWindow.document // contentDocument;
25+ */
26+ else
27+ return $(this);
28+ };
29+
30+ $.fn.documentSelection = function()
31+ {
32+ var element = this[0];
33+
34+ if ( element.contentWindow.document.selection )
35+ return element.contentWindow.document.selection.createRange().text;
36+ else
37+ return element.contentWindow.getSelection().toString();
38+ };
39+
40+ $.fn.wysiwyg = function( options )
41+ {
42+ if ( arguments.length > 0 && arguments[0].constructor == String )
43+ {
44+ var action = arguments[0].toString();
45+ var params = [];
46+
47+ for ( var i = 1; i < arguments.length; i++ )
48+ params[i - 1] = arguments[i];
49+
50+ if ( action in Wysiwyg )
51+ {
52+ return this.each(function()
53+ {
54+ $.data(this, 'wysiwyg')
55+ .designMode();
56+
57+ Wysiwyg[action].apply(this, params);
58+ });
59+ }
60+ else return this;
61+ }
62+
63+ var controls = {};
64+
65+ /**
66+ * If the user set custom controls, we catch it, and merge with the
67+ * defaults controls later.
68+ */
69+ if ( options && options.controls )
70+ {
71+ var controls = options.controls;
72+ delete options.controls;
73+ }
74+
75+ var options = $.extend({
76+ html : '<'+'?xml version="1.0" encoding="UTF-8"?'+'><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">STYLE_SHEET</head><body>INITIAL_CONTENT</body></html>',
77+ css : {},
78+
79+ debug : false,
80+
81+ autoSave : true, // http://code.google.com/p/jwysiwyg/issues/detail?id=11
82+ rmUnwantedBr : true, // http://code.google.com/p/jwysiwyg/issues/detail?id=15
83+ brIE : true,
84+
85+ controls : {},
86+ messages : {}
87+ }, options);
88+
89+ options.messages = $.extend(true, options.messages, Wysiwyg.MSGS_EN);
90+ options.controls = $.extend(true, options.controls, Wysiwyg.TOOLBAR);
91+
92+ for ( var control in controls )
93+ {
94+ if ( control in options.controls )
95+ $.extend(options.controls[control], controls[control]);
96+ else
97+ options.controls[control] = controls[control];
98+ }
99+
100+ // not break the chain
101+ return this.each(function()
102+ {
103+ Wysiwyg(this, options);
104+ });
105+ };
106+
107+ function Wysiwyg( element, options )
108+ {
109+ return this instanceof Wysiwyg
110+ ? this.init(element, options)
111+ : new Wysiwyg(element, options);
112+ }
113+
114+ $.extend(Wysiwyg, {
115+ insertImage : function( szURL, attributes )
116+ {
117+ var self = $.data(this, 'wysiwyg');
118+
119+ if ( self.constructor == Wysiwyg && szURL && szURL.length > 0 )
120+ {
121+ if ( attributes )
122+ {
123+ self.editorDoc.execCommand('insertImage', false, '#jwysiwyg#');
124+ var img = self.getElementByAttributeValue('img', 'src', '#jwysiwyg#');
125+
126+ if ( img )
127+ {
128+ img.src = szURL;
129+
130+ for ( var attribute in attributes )
131+ {
132+ img.setAttribute(attribute, attributes[attribute]);
133+ }
134+ }
135+ }
136+ else
137+ {
138+ self.editorDoc.execCommand('insertImage', false, szURL);
139+ }
140+ }
141+ },
142+
143+ createLink : function( szURL )
144+ {
145+ var self = $.data(this, 'wysiwyg');
146+
147+ if ( self.constructor == Wysiwyg && szURL && szURL.length > 0 )
148+ {
149+ var selection = $(self.editor).documentSelection();
150+
151+ if ( selection.length > 0 )
152+ {
153+ self.editorDoc.execCommand('unlink', false, []);
154+ self.editorDoc.execCommand('createLink', false, szURL);
155+ }
156+ else if ( self.options.messages.nonSelection )
157+ alert(self.options.messages.nonSelection);
158+ }
159+ },
160+
161+ setContent : function( newContent )
162+ {
163+ var self = $.data(this, 'wysiwyg');
164+ self.setContent( newContent );
165+ self.saveContent();
166+ },
167+
168+ clear : function()
169+ {
170+ var self = $.data(this, 'wysiwyg');
171+ self.setContent('');
172+ self.saveContent();
173+ },
174+
175+ MSGS_EN : {
176+ nonSelection : 'select the text you wish to link'
177+ },
178+
179+ TOOLBAR : {
180+ bold : { visible : true, tags : ['b', 'strong'], css : { fontWeight : 'bold' } },
181+ italic : { visible : true, tags : ['i', 'em'], css : { fontStyle : 'italic' } },
182+ strikeThrough : { visible : false, tags : ['s', 'strike'], css : { textDecoration : 'line-through' } },
183+ underline : { visible : false, tags : ['u'], css : { textDecoration : 'underline' } },
184+
185+ separator00 : { visible : false, separator : true },
186+
187+ justifyLeft : { visible : false, css : { textAlign : 'left' } },
188+ justifyCenter : { visible : false, tags : ['center'], css : { textAlign : 'center' } },
189+ justifyRight : { visible : false, css : { textAlign : 'right' } },
190+ justifyFull : { visible : false, css : { textAlign : 'justify' } },
191+
192+ separator01 : { visible : false, separator : true },
193+
194+ indent : { visible : false },
195+ outdent : { visible : false },
196+
197+ separator02 : { visible : false, separator : true },
198+
199+ subscript : { visible : false, tags : ['sub'] },
200+ superscript : { visible : false, tags : ['sup'] },
201+
202+ separator03 : { visible : false, separator : true },
203+
204+ undo : { visible : false },
205+ redo : { visible : false },
206+
207+ separator04 : { visible : false, separator : true },
208+
209+ insertOrderedList : { visible : false, tags : ['ol'] },
210+ insertUnorderedList : { visible : false, tags : ['ul'] },
211+ insertHorizontalRule : { visible : false, tags : ['hr'] },
212+
213+ separator05 : { separator : true },
214+
215+ createLink : {
216+ visible : true,
217+ exec : function()
218+ {
219+ var selection = $(this.editor).documentSelection();
220+
221+ if ( selection.length > 0 )
222+ {
223+ if ( $.browser.msie )
224+ this.editorDoc.execCommand('createLink', true, null);
225+ else
226+ {
227+ var szURL = prompt('URL', 'http://');
228+
229+ if ( szURL && szURL.length > 0 )
230+ {
231+ this.editorDoc.execCommand('unlink', false, []);
232+ this.editorDoc.execCommand('createLink', false, szURL);
233+ }
234+ }
235+ }
236+ else if ( this.options.messages.nonSelection )
237+ alert(this.options.messages.nonSelection);
238+ },
239+
240+ tags : ['a']
241+ },
242+
243+ insertImage : {
244+ visible : true,
245+ exec : function()
246+ {
247+ if ( $.browser.msie )
248+ this.editorDoc.execCommand('insertImage', true, null);
249+ else
250+ {
251+ var szURL = prompt('URL', 'http://');
252+
253+ if ( szURL && szURL.length > 0 )
254+ this.editorDoc.execCommand('insertImage', false, szURL);
255+ }
256+ },
257+
258+ tags : ['img']
259+ },
260+
261+ separator06 : { separator : true },
262+
263+ h1mozilla : { visible : true && $.browser.mozilla, className : 'h1', command : 'heading', arguments : ['h1'], tags : ['h1'] },
264+ h2mozilla : { visible : true && $.browser.mozilla, className : 'h2', command : 'heading', arguments : ['h2'], tags : ['h2'] },
265+ h3mozilla : { visible : true && $.browser.mozilla, className : 'h3', command : 'heading', arguments : ['h3'], tags : ['h3'] },
266+
267+ h1 : { visible : true && !( $.browser.mozilla ), className : 'h1', command : 'formatBlock', arguments : ['Heading 1'], tags : ['h1'] },
268+ h2 : { visible : true && !( $.browser.mozilla ), className : 'h2', command : 'formatBlock', arguments : ['Heading 2'], tags : ['h2'] },
269+ h3 : { visible : true && !( $.browser.mozilla ), className : 'h3', command : 'formatBlock', arguments : ['Heading 3'], tags : ['h3'] },
270+
271+ separator07 : { visible : false, separator : true },
272+
273+ cut : { visible : false },
274+ copy : { visible : false },
275+ paste : { visible : false },
276+
277+ separator08 : { separator : true && !( $.browser.msie ) },
278+
279+ increaseFontSize : { visible : true && !( $.browser.msie ), tags : ['big'] },
280+ decreaseFontSize : { visible : true && !( $.browser.msie ), tags : ['small'] },
281+
282+ separator09 : { separator : true },
283+
284+ html : {
285+ visible : false,
286+ exec : function()
287+ {
288+ if ( this.viewHTML )
289+ {
290+ this.setContent( $(this.original).val() );
291+ $(this.original).hide();
292+ }
293+ else
294+ {
295+ this.saveContent();
296+ $(this.original).show();
297+ }
298+
299+ this.viewHTML = !( this.viewHTML );
300+ }
301+ },
302+
303+ removeFormat : {
304+ visible : true,
305+ exec : function()
306+ {
307+ this.editorDoc.execCommand('removeFormat', false, []);
308+ this.editorDoc.execCommand('unlink', false, []);
309+ }
310+ }
311+ }
312+ });
313+
314+ $.extend(Wysiwyg.prototype,
315+ {
316+ original : null,
317+ options : {},
318+
319+ element : null,
320+ editor : null,
321+
322+ init : function( element, options )
323+ {
324+ var self = this;
325+
326+ this.editor = element;
327+ this.options = options || {};
328+
329+ $.data(element, 'wysiwyg', this);
330+
331+ var newX = element.width || element.clientWidth;
332+ var newY = element.height || element.clientHeight;
333+
334+ if ( element.nodeName.toLowerCase() == 'textarea' )
335+ {
336+ this.original = element;
337+
338+ if ( newX == 0 && element.cols )
339+ newX = ( element.cols * 8 ) + 21;
340+
341+ if ( newY == 0 && element.rows )
342+ newY = ( element.rows * 16 ) + 16;
343+
344+ var editor = this.editor = $('<iframe></iframe>').css({
345+ minHeight : ( newY - 6 ).toString() + 'px',
346+ width : ( newX - 8 ).toString() + 'px'
347+ }).attr('id', $(element).attr('id') + 'IFrame');
348+
349+ if ( $.browser.msie )
350+ {
351+ this.editor
352+ .css('height', ( newY ).toString() + 'px');
353+
354+ /**
355+ var editor = $('<span></span>').css({
356+ width : ( newX - 6 ).toString() + 'px',
357+ height : ( newY - 8 ).toString() + 'px'
358+ }).attr('id', $(element).attr('id') + 'IFrame');
359+
360+ editor.outerHTML = this.editor.outerHTML;
361+ */
362+ }
363+ }
364+
365+ var panel = this.panel = $('<ul></ul>').addClass('panel');
366+
367+ this.appendControls();
368+ this.element = $('<div></div>').css({
369+ width : ( newX > 0 ) ? ( newX ).toString() + 'px' : '100%'
370+ }).addClass('wysiwyg')
371+ .append(panel)
372+ .append( $('<div><!-- --></div>').css({ clear : 'both' }) )
373+ .append(editor);
374+
375+ $(element)
376+ // .css('display', 'none')
377+ .hide()
378+ .before(this.element);
379+
380+ this.viewHTML = false;
381+
382+ this.initialHeight = newY - 8;
383+
384+ /**
385+ * @link http://code.google.com/p/jwysiwyg/issues/detail?id=52
386+ */
387+ this.initialContent = $(element).val();
388+
389+ this.initFrame();
390+
391+ if ( this.initialContent.length == 0 )
392+ this.setContent('');
393+
394+ if ( this.options.autoSave )
395+ $('form').submit(function() { self.saveContent(); });
396+
397+ $('form').bind('reset', function()
398+ {
399+ self.setContent( self.initialContent );
400+ self.saveContent();
401+ });
402+ },
403+
404+ initFrame : function()
405+ {
406+ var self = this;
407+ var style = '';
408+
409+ /**
410+ * @link http://code.google.com/p/jwysiwyg/issues/detail?id=14
411+ */
412+ if ( this.options.css && this.options.css.constructor == String )
413+ style = '<link rel="stylesheet" type="text/css" media="screen" href="' + this.options.css + '" />';
414+
415+ this.editorDoc = $(this.editor).document();
416+ this.editorDoc_designMode = false;
417+
418+ try {
419+ this.editorDoc.designMode = 'on';
420+ this.editorDoc_designMode = true;
421+ } catch ( e ) {
422+ // Will fail on Gecko if the editor is placed in an hidden container element
423+ // The design mode will be set ones the editor is focused
424+
425+ $(this.editorDoc).focus(function()
426+ {
427+ self.designMode();
428+ });
429+ }
430+
431+ this.editorDoc.open();
432+ this.editorDoc.write(
433+ this.options.html
434+ .replace(/INITIAL_CONTENT/, this.initialContent)
435+ .replace(/STYLE_SHEET/, style)
436+ );
437+ this.editorDoc.close();
438+ this.editorDoc.contentEditable = 'true';
439+
440+ if ( $.browser.msie )
441+ {
442+ /**
443+ * Remove the horrible border it has on IE.
444+ */
445+ setTimeout(function() { $(self.editorDoc.body).css('border', 'none'); }, 0);
446+ }
447+
448+ $(this.editorDoc).click(function( event )
449+ {
450+ self.checkTargets( event.target ? event.target : event.srcElement);
451+ });
452+
453+ /**
454+ * @link http://code.google.com/p/jwysiwyg/issues/detail?id=20
455+ */
456+ $(this.original).focus(function()
457+ {
458+ $(self.editorDoc.body).focus();
459+ });
460+
461+ if ( this.options.autoSave )
462+ {
463+ /**
464+ * @link http://code.google.com/p/jwysiwyg/issues/detail?id=11
465+ */
466+ $(this.editorDoc).keydown(function() { self.saveContent(); })
467+ .keyup(function() { self.saveContent(); })
468+ .mousedown(function() { self.saveContent(); });
469+ }
470+
471+ if ( this.options.css )
472+ {
473+ setTimeout(function()
474+ {
475+ if ( self.options.css.constructor == String )
476+ {
477+ /**
478+ * $(self.editorDoc)
479+ * .find('head')
480+ * .append(
481+ * $('<link rel="stylesheet" type="text/css" media="screen" />')
482+ * .attr('href', self.options.css)
483+ * );
484+ */
485+ }
486+ else
487+ $(self.editorDoc).find('body').css(self.options.css);
488+ }, 0);
489+ }
490+
491+ $(this.editorDoc).keydown(function( event )
492+ {
493+ if ( $.browser.msie && self.options.brIE && event.keyCode == 13 )
494+ {
495+ var rng = self.getRange();
496+ rng.pasteHTML('<br />');
497+ rng.collapse(false);
498+ rng.select();
499+
500+ return false;
501+ }
502+ });
503+ },
504+
505+ designMode : function()
506+ {
507+ if ( !( this.editorDoc_designMode ) )
508+ {
509+ try {
510+ this.editorDoc.designMode = 'on';
511+ this.editorDoc_designMode = true;
512+ } catch ( e ) {}
513+ }
514+ },
515+
516+ getSelection : function()
517+ {
518+ return ( window.getSelection ) ? window.getSelection() : document.selection;
519+ },
520+
521+ getRange : function()
522+ {
523+ var selection = this.getSelection();
524+
525+ if ( !( selection ) )
526+ return null;
527+
528+ return ( selection.rangeCount > 0 ) ? selection.getRangeAt(0) : selection.createRange();
529+ },
530+
531+ getContent : function()
532+ {
533+ return $( $(this.editor).document() ).find('body').html();
534+ },
535+
536+ setContent : function( newContent )
537+ {
538+ $( $(this.editor).document() ).find('body').html(newContent);
539+ },
540+
541+ saveContent : function()
542+ {
543+ if ( this.original )
544+ {
545+ var content = this.getContent();
546+
547+ if ( this.options.rmUnwantedBr )
548+ content = ( content.substr(-4) == '<br>' ) ? content.substr(0, content.length - 4) : content;
549+
550+ $(this.original).val(content);
551+ }
552+ },
553+
554+ appendMenu : function( cmd, args, className, fn )
555+ {
556+ var self = this;
557+ var args = args || [];
558+
559+ $('<li></li>').append(
560+ $('<a><!-- --></a>').addClass(className || cmd)
561+ ).mousedown(function() {
562+ if ( fn ) fn.apply(self); else self.editorDoc.execCommand(cmd, false, args);
563+ if ( self.options.autoSave ) self.saveContent();
564+ }).appendTo( this.panel );
565+ },
566+
567+ appendMenuSeparator : function()
568+ {
569+ $('<li class="separator"></li>').appendTo( this.panel );
570+ },
571+
572+ appendControls : function()
573+ {
574+ for ( var name in this.options.controls )
575+ {
576+ var control = this.options.controls[name];
577+
578+ if ( control.separator )
579+ {
580+ if ( control.visible !== false )
581+ this.appendMenuSeparator();
582+ }
583+ else if ( control.visible )
584+ {
585+ this.appendMenu(
586+ control.command || name, control.arguments || [],
587+ control.className || control.command || name || 'empty', control.exec
588+ );
589+ }
590+ }
591+ },
592+
593+ checkTargets : function( element )
594+ {
595+ for ( var name in this.options.controls )
596+ {
597+ var control = this.options.controls[name];
598+ var className = control.className || control.command || name || 'empty';
599+
600+ $('.' + className, this.panel).removeClass('active');
601+
602+ if ( control.tags )
603+ {
604+ var elm = element;
605+
606+ do {
607+ if ( elm.nodeType != 1 )
608+ break;
609+
610+ if ( $.inArray(elm.tagName.toLowerCase(), control.tags) != -1 )
611+ $('.' + className, this.panel).addClass('active');
612+ } while ( elm = elm.parentNode );
613+ }
614+
615+ if ( control.css )
616+ {
617+ var elm = $(element);
618+
619+ do {
620+ if ( elm[0].nodeType != 1 )
621+ break;
622+
623+ for ( var cssProperty in control.css )
624+ if ( elm.css(cssProperty).toString().toLowerCase() == control.css[cssProperty] )
625+ $('.' + className, this.panel).addClass('active');
626+ } while ( elm = elm.parent() );
627+ }
628+ }
629+ },
630+
631+ getElementByAttributeValue : function( tagName, attributeName, attributeValue )
632+ {
633+ var elements = this.editorDoc.getElementsByTagName(tagName);
634+
635+ for ( var i = 0; i < elements.length; i++ )
636+ {
637+ var value = elements[i].getAttribute(attributeName);
638+
639+ if ( $.browser.msie )
640+ {
641+ /** IE add full path, so I check by the last chars. */
642+ value = value.substr(value.length - attributeValue.length);
643+ }
644+
645+ if ( value == attributeValue )
646+ return elements[i];
647+ }
648+
649+ return false;
650+ }
651+ });
652+})(jQuery);
\ No newline at end of file
--- a/js/lunardial/feedblog_gen.js
+++ b/js/lunardial/feedblog_gen.js
@@ -33,14 +33,14 @@ function applyChange(){
3333 entry.published = dateRfc3339;
3434 entry.updated = dateRfc3339;
3535 entry.link = pageAddr + entry.id;
36- entry.content = xmlAttrContentEscape(document.getElementById("content").value);
36+ entry.content = xmlAttrContentEscape(convertContent(document.getElementById("stdin").value));
3737
3838 entryList.unshift(entry);
3939 }
4040 else {
4141 entryList[editIndex].title = xmlAttrContentEscape(document.getElementById("title").value);
4242 entryList[editIndex].updated = getDate();
43- entryList[editIndex].content = xmlAttrContentEscape(convertContent(document.getElementById("content").value));
43+ entryList[editIndex].content = xmlAttrContentEscape(convertContent(document.getElementById("stdin").value));
4444 }
4545
4646 refleshComboBox();
@@ -54,7 +54,7 @@ function removeEntry(index){
5454
5555 document.getElementById("stdout").value = ""
5656 document.getElementById("title").value = "";
57- document.getElementById("content").value = "";
57+ document.getElementById("stdin").value = "";
5858 }
5959 }
6060
@@ -90,20 +90,20 @@ function analyzeTargetXml(xmlData){
9090
9191 refleshComboBox();
9292 document.getElementById("title").value = "";
93- document.getElementById("content").value = "";
94- document.getElementById("stdout").value = "";
93+ document.getElementById("stdin").value = "";
94+ document.getElementById("stdout").value = "";
9595 editIndex = -1;
9696 }
9797
9898 function entryLoader(index){
9999 if (index < 0) {
100100 document.getElementById("title").value = "";
101- document.getElementById("content").value = "";
101+ document.getElementById("stdin").value = "";
102102 editIndex = -1;
103103 }
104104 else {
105105 document.getElementById("title").value = entryList[index].title;
106- document.getElementById("content").value = entryList[index].content;
106+ document.getElementById("stdin").value = entryList[index].content;
107107 editIndex = index;
108108 }
109109 }
@@ -117,7 +117,7 @@ function refleshComboBox(){
117117 }
118118 stringBuffer.push("</select></form>");
119119 // コンボボックス要素を生成
120- editIndex = -1;
120+ editIndex = -1;
121121 document.getElementById("entrySelect").innerHTML = stringBuffer.join("");
122122 }
123123
@@ -126,15 +126,15 @@ function refleshComboBox(){
126126 * @param {Object} obj
127127 */
128128 function FeedInfo(obj){
129- this.title = $("title:first", obj).text();
130- this.subtitle = $("subtitle:first", obj).text();
131- this.self = $("link[rel=self]", obj).attr("href")
132- this.alternate = $("link[rel=alternate]", obj).attr("href")
133- this.updated = $("updated:first", obj).text();
134- this.id = $("id:first", obj).text();
135- this.rights = $("rights:first", obj).text();
136- this.authorname = $("author>name", obj).text();
137- this.authoremail = $("author>email", obj).text();
129+ this.title = xmlAttrContentEscape($("title:first", obj).text());
130+ this.subtitle = xmlAttrContentEscape($("subtitle:first", obj).text());
131+ this.self = xmlAttrContentEscape($("link[rel=self]", obj).attr("href"));
132+ this.alternate = xmlAttrContentEscape($("link[rel=alternate]", obj).attr("href"));
133+ this.updated = xmlAttrContentEscape($("updated:first", obj).text());
134+ this.id = xmlAttrContentEscape($("id:first", obj).text());
135+ this.rights = xmlAttrContentEscape($("rights:first", obj).text());
136+ this.authorname = xmlAttrContentEscape($("author>name", obj).text());
137+ this.authoremail = xmlAttrContentEscape($("author>email", obj).text());
138138 }
139139
140140 /**
@@ -142,13 +142,13 @@ function FeedInfo(obj){
142142 * @param {Object} obj entry 要素の DOM オブジェクト
143143 */
144144 function Entry(obj){
145- this.id = $("id:first", obj).text();
146- this.title = $("title:first", obj).text();
147- this.summary = $("summary:first", obj).text();
148- this.published = $("published:first", obj).text();
149- this.updated = $("updated:first", obj).text();
150- this.link = $("link:first", obj).attr("href");
151- this.content = $("content:first", obj).text();
145+ this.id = xmlAttrContentEscape($("id:first", obj).text());
146+ this.title = xmlAttrContentEscape($("title:first", obj).text());
147+ this.summary = xmlAttrContentEscape($("summary:first", obj).text());
148+ this.published = xmlAttrContentEscape($("published:first", obj).text());
149+ this.updated = xmlAttrContentEscape($("updated:first", obj).text());
150+ this.link = xmlAttrContentEscape($("link:first", obj).attr("href"));
151+ this.content = xmlAttrContentEscape($("content:first", obj).text());
152152 }
153153
154154 /**
@@ -199,9 +199,13 @@ function toXml(finfo, elist){
199199 * @param {Object} content
200200 */
201201 function convertContent(content){
202+ if (!jQuery.browser.msie) {
203+ content = content.replace(/[ ]*$/g, "");
204+ }
205+
202206 if (validateMode == 0) {
203- content = content.replace(/(\r\n|\n)/g, "");
204- content = content.replace(/(<br>|<\/p>|<\/h\d>|<\/div>)(?=[^\n])/i, "$1\n");
207+ content = content.replace(/[\n\r]|\r\n/g, "");
208+ content = content.replace(/(<br>|<\/p>|<\/h\d>|<\/div>)(?=[^\n])/ig, "$1\n");
205209 }
206210 else {
207211 content = content.replace(/<br>/ig, "\n");
--- a/xml/diary.xml
+++ b/xml/diary.xml
@@ -1,44 +1,70 @@
11 <?xml version="1.0" encoding="utf-8"?>
2-<feed xml:lang="ja-jp" xmlns="http://www.w3.org/2005/Atom">
3-
4-<title type="text">さんぷる</title>
5-<subtitle type="text">このファイルはサンプルのファイルです。</subtitle>
6-<link rel="self" type="application/atom+xml" href="" />
7-<link rel="alternate" type="text/html" href="http://www.yourdomain.com/index.html" />
8-<updated>2009-01-27T22:07:10+09:00</updated>
9-<id>urn:uuid:sample</id>
10-<rights type="text">Copyright (c) YYYY, [Please input your name.]</rights>
2+<feed xml:lang='ja-jp'
3+xmlns='http://www.w3.org/2005/Atom'>
4+<title type="text">風雅</title>
5+<subtitle type="text">壁紙と日記のウェブサイトです。</subtitle>
6+<link rel="self" type="application/atom+xml" href="http://lunardial.sakura.ne.jp/xml/diary.xml" />
7+<link rel="alternate" type="text/html" href="http://lunardial.sakura.ne.jp/index.html" />
8+<updated>2009-06-02T22:07:07+09:00</updated>
9+<id>http://lunardial.sakura.ne.jp/index.html</id>
10+<rights type="text">Copyright (c) 2008, K.Hisame</rights>
1111 <author>
12- <name>Please input your name.</name>
13- <email>Please input your e-mail.</email>
12+ <name>K.Hisame</name>
13+ <email>luanrdial@hotmail.com</email>
1414 </author>
1515
1616 <entry>
17-<id>urn:uuid:sample;2009-01-27T22:03:57+09:00</id>
18-<title>タグの取り扱いについて</title>
17+<id>http://lunardial.sakura.ne.jp/index.html?2009-06-02T21:53:44+09:00</id>
18+<title>サクラちゃん洗濯機(横)に負けず</title>
1919 <summary></summary>
20-<published>2009-01-27T22:03:57+09:00</published>
21-<updated>2009-01-27T22:03:57+09:00</updated>
22-<link href="../index.html#urn:uuid:sample;2009-01-27T22:03:57+09:00" />
23-<content type="html"> FeedBlog Scriptでは&lt;span style=&quot;font-weight: bold;&quot;&gt;このように&lt;/span&gt;、タグを扱うことも可能です。
24- ただしその際はエンティティ参照でタグを書く必要があります。
25- 詳しくはXML標準のエンティティ参照に関するドキュメントか、ウェブページをご覧下さい。
26-
27-・&lt;a href=&quot;http://msdn.microsoft.com/ja-jp/library/ms256190(VS.80).aspx&quot; target=&quot;_blank&quot; &gt;文字参照とエンティティ参照[XMl標準]&lt;/a&gt; (MSDN)
28-・&lt;a href=&quot;http://gogodiet.net/z/xml/3_10.htm&quot; target=&quot;_blank&quot; &gt;XML エンティティ参照(エスケープ文字)&lt;/a&gt;
29-</content>
20+<published>2009-06-02T21:53:44+09:00</published>
21+<updated>2009-06-02T21:53:44+09:00</updated>
22+<link href="http://lunardial.sakura.ne.jp/index.html#http://lunardial.sakura.ne.jp/index.html?2009-06-02T21:53:44+09:00" />
23+<content type="html">&amp;nbsp;&lt;iframe src=&quot;http://ext.nicovideo.jp/thumb/sm7205037&quot; style=&quot;border: 1px solid #CCCCCC;&quot; scrolling=&quot;no&quot; width=&quot;312&quot; frameborder=&quot;0&quot; height=&quot;176&quot;&gt;&amp;amp;lt;a href=&quot;http://www.nicovideo.jp/watch/sm7205037&quot;&amp;amp;gt;【ニコニコ動画】Xbox360版デススマイルズMBL 『ブラッディージルバ』(5/5)&amp;amp;lt;/a&amp;amp;gt;&lt;/iframe&gt;&lt;br&gt;
24+&lt;br&gt;
25+ 「リスタートを駆使しても出る(が、実績は解除されない)」という情報があったので、もしかすると誰かがやってくれるかもしれない!とおもったら、以前「&lt;a name=&quot;&quot; target=&quot;_blank&quot; classname=&quot;&quot; class=&quot;&quot; href=&quot;http://www.nicovideo.jp/tag/%E5%8D%91%E6%80%AF%E3%81%AA%E3%82%B5%E3%82%AF%E3%83%A9%E3%81%A1%E3%82%83%E3%82%93&quot;&gt;卑怯なサクラちゃん&lt;/a&gt;」で真ボス出現するか!?に挑んでいた人なのだけど、リスタートを駆使して引きずり出してくれた!素晴らしい!&lt;br&gt;
26+ にしてもコレはひどい。出す条件がひどく難しいから、手加減無しじゃないか!&lt;br&gt;
27+ でもボムが効くから、これならごり押しできないでもないのかな・・・・・。&lt;br&gt;
28+ ・・・・・にしてもこの人も十分立ち回りがおかしいくらい上手い。うーん。&lt;br&gt;
29+&lt;br&gt;
30+ 横洗濯機に横シンデレラアンバーとはありがたやありがたや・・・・・。&lt;br&gt;
31+&lt;br&gt;
32+ &lt;a name=&quot;&quot; target=&quot;_blank&quot; classname=&quot;&quot; class=&quot;&quot; href=&quot;./xml/img/2009/20090602_01.jpg&quot;&gt;&lt;img alt=&quot;&quot; style=&quot;width: 120px; height: 90px;&quot; src=&quot;./xml/img/2009/20090602_01.jpg&quot; vspace=&quot;&quot; border=&quot;0&quot; hspace=&quot;&quot;&gt;&lt;/a&gt;&lt;br&gt;
33+ こっちはケロちゃん暴風雨に負けず。いや、実は東風戦であっという間に連続で詰まれて3位とかになったりしていたのだけど、このごろはケロちゃん。&lt;br&gt;
34+ まずい配牌を、素変換を噛まして上手いことカヴァーしようという。&lt;br&gt;
35+ &lt;br&gt;
36+ この頃全然起動していないというか、、まったくやっていないPSUどうしよう!というか実は課金が切れました(&lt;span style=&quot;font-weight: bold;&quot;&gt;きりました&lt;/span&gt;)。いやあだってイベントも無いし、GBRはしょっぱかったし・・・・・。&lt;br&gt;
37+ そういやウィッチテイルが欲しいから今週こそ売っていることを祈って買いに行こう。・・・・・にゃ、そんならAmazonがいいかな?&lt;br&gt;</content>
3038 </entry>
3139
3240 <entry>
33-<id>urn:uuid:sample;2008-10-24T21:03:18+09:00</id>
34-<title>にっきてすと</title>
35-<summary>この日記はテストです。</summary>
36-<published>2008-10-24T21:03:18+09:00</published>
37-<updated>2008-10-24T21:03:18+09:00</updated>
38-<link href="../index.html#urn:uuid:sample;2008-10-24T21:03:18+09:00" />
39-<content type="html"> この日記はテスト日記です。
40- 基本的な機能、及び正常に表示できているかを確認するのにご使用下さい。
41-</content>
41+<id>http://lunardial.sakura.ne.jp/index.html?2009-06-01T21:21:15+09:00</id>
42+<title>2009.06.01</title>
43+<summary></summary>
44+<published>2009-06-01T21:21:15+09:00</published>
45+<updated>2009-06-01T23:38:49+09:00</updated>
46+<link href="http://lunardial.sakura.ne.jp/index.html#http://lunardial.sakura.ne.jp/index.html?2009-06-01T21:21:15+09:00" />
47+<content type="html"> あっという間に6月になってしまいました。紅葉です。&lt;br&gt;
48+&lt;br&gt;
49+ 取り敢えずそろそろ、エヴァンゲリオン : 破の公開が迫ってきて、予告画像にまた半裸のカヲル君が写っていて、「&lt;span style=&quot;font-weight: bold; color: #FF0000;&quot;&gt;じゃあボーナスでカヲル君だけ100回見よう!&lt;/span&gt;」とか思って計算すると、実際には100回見れるくらいは貰うけどもったいないし云々かんぬん。&lt;br&gt;
50+ 真剣な話ボーナスで何をしよう。と思ったんだけど、今のモニターの組み合わせが&lt;a name=&quot;&quot; target=&quot;_blank&quot; classname=&quot;&quot; class=&quot;&quot; href=&quot;http://www.mitsubishielectric.co.jp/home/display/product/mdt242wg/index.html&quot;&gt;MDT242WG&lt;/a&gt;と、&lt;a name=&quot;&quot; target=&quot;_blank&quot; classname=&quot;&quot; class=&quot;&quot; href=&quot;http://www.mitsubishielectric.co.jp/home/display/product/rdt1713s/&quot;&gt;RDT1713S&lt;/a&gt;の組み合わせで、Dualなのに左右非対称なのよね。&lt;br&gt;
51+ なのでRDT1713Sのほうを親に上げて、MDT243WGを買って左右対称WUXGAにするか計画中。やっぱりゲームやるときとか、サブモニターが狭くて。&lt;br&gt;
52+&lt;br&gt;
53+ &lt;a name=&quot;&quot; target=&quot;_blank&quot; classname=&quot;&quot; class=&quot;&quot; href=&quot;./xml/img/2009/20090601_01.jpg&quot;&gt;&lt;img alt=&quot;&quot; style=&quot;width: 120px; height: 90px;&quot; src=&quot;./xml/img/2009/20090601_01.jpg&quot; vspace=&quot;&quot; border=&quot;0&quot; hspace=&quot;&quot;&gt;&lt;/a&gt;&lt;br&gt;
54+ やっぱりラス親は勝負どころなのかしら私。&lt;br&gt;
55+ 西家とかだと運が無い。とにかく運が無い。起親か、ラス親あたりだと運が回ってくる。のは、ただの確率なのかしら。それともラストだとがっつくからなのかしら。&lt;br&gt;
56+ むしろ西なりでも、がっつけるようにするべきなのかしら。うーん&lt;br&gt;
57+&lt;br&gt;
58+ &lt;span style=&quot;font-weight: bold;&quot;&gt;追記&lt;/span&gt; : とか書いてたら勝った。やっぱがっつくべきみたいな。&lt;br&gt;
59+ &lt;a name=&quot;&quot; target=&quot;_blank&quot; classname=&quot;&quot; class=&quot;&quot; href=&quot;./xml/img/2009/20090601_02.jpg&quot;&gt;&lt;img alt=&quot;&quot; style=&quot;width: 120px; height: 90px;&quot; src=&quot;./xml/img/2009/20090601_02.jpg&quot; vspace=&quot;&quot; border=&quot;0&quot; hspace=&quot;&quot;&gt;&lt;/a&gt;&lt;br&gt;
60+&lt;br&gt;
61+▼ MassEffectは面白いよね…AIは邪魔だけどwそこに居たら俺攻撃できないだろ…ってのがねw&lt;br&gt;
62+○ たまに味方にハンドガン打ち込んだり、味方にショットガンぶち込まれたりするよね(&lt;br&gt;
63+ 私はアデプトだから、適当に味方を前進させて、スロウなりステーシスなりで止めるけど。というかいい加減ハンドガンだけで戦うのは飽きてきました!&lt;br&gt;
64+&lt;br&gt;
65+▼ なんだこのMBLの秘密の実績・・・無理すぎる・・・!&lt;br&gt;
66+○ いい加減裏2ALLくらいの実力は必要な感じが!&lt;br&gt;
67+ LV999どころか、それを絶するモノとな。さすがにあきらめました!&lt;br&gt;</content>
4268 </entry>
4369
44-</feed>
70+</feed>
\ No newline at end of file
Show on old repository browser