diff --git a/index.html b/index.html index edff405..b8e1c44 100755 --- a/index.html +++ b/index.html @@ -106,6 +106,7 @@ CKEDITOR.disableAutoInline = true + diff --git a/lib/_template.js b/lib/_template.js index 72b424f..4172080 100755 --- a/lib/_template.js +++ b/lib/_template.js @@ -1,4 +1,3 @@ - /********************************************************************** * * diff --git a/templates.js b/templates.js new file mode 100755 index 0000000..2bde419 --- /dev/null +++ b/templates.js @@ -0,0 +1,108 @@ +/********************************************************************** +* +* +* +**********************************************************************/ + +//var DEBUG = DEBUG != null ? DEBUG : true + +var STUB_TEXT = 'Lorem ipsum dolor sit amet, consectetuer adipiscing '+ + 'elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore '+ + 'magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis '+ + 'nostrud exerci tation ullamcorper suscipit lobortis nisl ut '+ + 'aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor '+ + 'in hendrerit in vulputate velit esse molestie consequat, vel '+ + 'illum dolore eu feugiat nulla facilisis at vero eros et accumsan '+ + 'et iusto odio dignissim qui blandit praesent luptatum zzril '+ + 'delenit augue duis dolore te feugait nulla facilisi. Nam liber '+ + 'tempor cum soluta nobis eleifend option congue nihil imperdiet '+ + 'doming id quod mazim placerat facer possim assum. Typi non habent '+ + 'claritatem insitam; est usus legentis in iis qui facit eorum '+ + 'claritatem. Investigationes demonstraverunt lectores legere me '+ + 'lius quod ii legunt saepius.' + +var STUB_VERTICAL_IMAGE_URL = 'img.jpg' +var STUB_HORIZONTAL_IMAGE_URL = 'landscape.jpg' + + +/*********************************************************************/ + +function Element(cls, content, classes, style, attrs){ + return $('
') + .addClass(cls + (classes != null ? (' ' + classes) : '') ) + .css(style != null ? style : {}) + .attr(attrs != null ? attrs : {}) + .append(content) +} + + +/*********************************************************************/ +// XXX this intersects with magazine constructors in magazine.js... + +function Group(content, classes, style){ + return Element('group', content, classes, style) +} + +function Page(content, classes){ + return Element('page', content, classes) +} + +function Content(content, classes, style, attrs){ + return Element('content', content, classes, style, attrs) +} + + + +/*********************************************************************/ +// XXX for some reason in these pages in inline-editor-mode Esc will both +// exit the inline editor and the editor mode, when only the earlier +// should happen... + +function RawPage(text){ + text = text != null ? text : 'Raw Page' + return Page(Content('Raw Page', null, null, {contenteditable: 'False'})) +} + + +function TextPage(title, text){ + title = title != null ? title : 'Text Page' + text = text != null ? text : STUB_TEXT + return Page(Content($( + '

'+title+'

'+ + '
'+text+'
'+ + '
[PAGE NUMBER]
'))) +} + + +function CaptionPage(text){ + text = text != null ? text : '

Caption Page

'+STUB_TEXT+'

' + return Page(Content(text, null, null, {contenteditable: 'false'}), 'caption-bottom-arrow') +} + + +function ImagePage(url, caption){ + url = url != null ? url : STUB_HORIZONTAL_IMAGE_URL + caption = caption != null ? caption : '

Image Caption

' + STUB_TEXT + return Page(Content($( + '
'+caption+'
'+ + '
[PAGE NUMBER]
'), + null, + {'background-image': 'url('+url+')'}), + 'image-fit') +} + + +function ImageFitHeightPage(url, caption){ + url = url != null ? url : STUB_HORIZONTAL_IMAGE_URL + caption = caption != null ? caption : '

Image Caption

' + STUB_TEXT + return Page(Content($( + ''+ + '
'+caption+'
'+ + '
[PAGE NUMBER]
'), + 'image-fit-height') +} + + + +/********************************************************************** +* vim:set ts=4 sw=4 : */