--- takahashi.xul 2006/06/09 21:15:49 1 +++ takahashi.xul 2006/06/09 22:03:42 4 @@ -718,10 +718,10 @@ var image_total_height = 0; var image_src; - var labelId = 0; + var labelId = 0; var lineRegExp = this.makePhraseRegExp('^([^%O]+)?(%O%Oem:((.+?)(:em)?%C%C)?|%O%Opre:((.+?)(:pre)?%C%C)?|%O%O\#[^:]+:((.+?)%C%C)?|%O%Oima?ge? +src="([^"]+)" +width="([0-9]+)" +height="([0-9]+)"[^%C]*%C%C|%O%O(([^\|]+)?\\||)([^%C]+)%C%C|%O([^%C]+)%C)(.+)?', 'i'); - var emRegExp = this.makePhraseRegExp('^([^%O]+)?%O%Oem:(.+?)()?%C%C', 'i'); + var emRegExp = this.makePhraseRegExp('^([^%O]+)?%O%Oem:(.+?)(:em)?%C%C', 'i'); var emStartRegExp = this.makePhraseRegExp('^([^%O]+)?%O%Oem:(.*)', 'i'); var emEndRegExp = this.makePhraseRegExp('^(.*?)((:em)?%C%C)', 'i'); @@ -737,6 +737,8 @@ var linksRegExp = this.makePhraseRegExp('^([^%O]+)?%O%O(([^|]+)?\\||)([^%C]+)%C%C', ''); + var wikiRegExp = this.makePhraseRegExp('^([^%O]+)?%O([0-9]*)([:\/\*_])([^%C]+)[:\/\*_]%C', ''); + var montaRegExp = this.makePhraseRegExp('^([^%O]+)?%O([^%C]+)%C', ''); var inBlock = false, @@ -881,6 +883,21 @@ this.clickableNodes.push(fragment.lastChild.lastChild); } + // modify font size and wiki-style + else if (wikiRegExp.test(line)) { + fragment.lastChild.appendChild(document.createElement('description')); + fragment.lastChild.lastChild.setAttribute('value', RegExp.$4); + var style = 'font-size:'+ ( RegExp.$2 || 100 ) +'%'; + if (RegExp.$3 == '*') { + style += '; font-weight: bold;'; + } else if (RegExp.$3 == '/') { + style += '; font-style: italic;'; + } else if (RegExp.$3 == '_') { + style += '; text-decoration: underline;'; + } + fragment.lastChild.lastChild.setAttribute('style', style); + } + // Monta else if (montaRegExp.test(line)) { fragment.lastChild.appendChild(document.createElement('stack')); @@ -1712,14 +1729,14 @@ { var now = (new Date()).getTime(); if (aStart === void(0) || aEnd === void(0)) { - var rest = prompt('Remaining Time (minits)'); - if (rest == '') { - this.resetTimer(); + var rest = prompt('Remaining Time (minits)'); + if (rest == '') { + this.resetTimer(); return; - } + } else { rest = Number(rest); - if (!rest || isNaN(rest)) return; + if (!rest || isNaN(rest)) return; } rest = Math.abs(rest);