diff options
author | drry | 2008-12-21 15:43:28 +0000 |
---|---|---|
committer | drry | 2008-12-21 15:43:28 +0000 |
commit | e8ca892a98f55a1d72769c1049d43a96e978bfef (patch) | |
tree | 153b10e04d38b9c69d8fe462ab945cbfc7929ad3 | |
parent | 84c36d7eea23a795283d1d89e15ee5fb2dd8f0d8 (diff) | |
download | vimperator-plugins-e8ca892a98f55a1d72769c1049d43a96e978bfef.tar.bz2 |
* fixed regexes.
* et cetera.
git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@27172 d0d07461-0603-4401-acd4-de1884942a52
-rw-r--r-- | takahashiPresentation.js | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/takahashiPresentation.js b/takahashiPresentation.js index 161445f..7bb33a3 100644 --- a/takahashiPresentation.js +++ b/takahashiPresentation.js @@ -13,7 +13,7 @@ var PLUGIN_INFO = presentation: start presentation == HOWTO == -open html file includes <pre id="page">...</pre> and <div id="text">...</pre>. +open HTML file includes <pre id="page">...</pre> and <div id="text">...</div>. start :presentation. ]]></detail> </VimperatorPlugin>; @@ -71,16 +71,17 @@ start :presentation. loadPage(curpage); } function parsePages(text) { - if(/:backgroundImage:(.+)\n/.test(text)) { + if(/:backgroundImage:(.+)(?:\r\n|[\r\n])/.test(text)) { doc.body.style.backgroundImage = RegExp.$1; doc.body.style.backgroundRepeat = 'repeat'; } - text = text.replace(/:.+\n/g, ''); - return text.split('----').map(function(txt) txt.replace(/^\n/, '').replace(/\n$/, '')); + return text.replace(/(?::.+(?:\r\n|[\r\n]))+/g, '') + .split('----') + .map(function(txt) txt.replace(/^(?:\r\n|[\r\n])|(?:\r\n|[\r\n])$/g, '')); } function start() { options.fullscreen = true; - options.guioptions = ""; + options.guioptions = ''; win = window.content; doc = win.document; let text = buffer.evaluateXPath('//div[@id="text"]').snapshotItem(0); @@ -88,9 +89,8 @@ start :presentation. addKeys(); div = doc.createElement('div'); - head = doc.createElement('div'); + head = doc.body.appendChild(doc.createElement('div')); head.style.textAlign = 'right'; - doc.body.appendChild(head); pre = buffer.evaluateXPath('//pre[@id="page"]').snapshotItem(0); pre.style.fontSize = fontSize+'px'; |