From d66e91b8a4989ac9b80c638f3f79d495c1296723 Mon Sep 17 00:00:00 2001 From: Daniel Kao Date: Sat, 30 Nov 2024 21:24:58 +0800 Subject: [PATCH] refactor: remove unused files --- app/src/main/assets/taketori.css | 421 -------- app/src/main/assets/taketori.js | 1687 ------------------------------ 2 files changed, 2108 deletions(-) delete mode 100644 app/src/main/assets/taketori.css delete mode 100644 app/src/main/assets/taketori.js diff --git a/app/src/main/assets/taketori.css b/app/src/main/assets/taketori.css deleted file mode 100644 index 81287459..00000000 --- a/app/src/main/assets/taketori.css +++ /dev/null @@ -1,421 +0,0 @@ -@charset "UTF-8"; - -.taketori-sans-serif-ja-jp { - font-family: Avenir, 'Lucida Grande', 'Helvetica Neue', Helvetica, Arial, Verdana, Roboto, 'ヒラギノ角ゴ Pro W3', 'Hiragino Kaku Gothic Pro', '游ゴシック', 'Yu Gothic', '游ゴシック体', 'YuGothic', 'Meiryo UI', 'メイリオ', Meiryo, 'MS Pゴシック', 'MS PGothic', sans-serif; -} - -.taketori-sans-serif-zh-tw { - font-family: 'Heiti TC', 'LiHei Pro', '微軟正黑體', sans-serif !important; -} - -.taketori-serif-ja-jp { - font-family: Garamond, 'Times New Roman', 'ヒラギノ明朝 Pro W3', 'Hiragino Mincho Pro', 'HiraMinProN-W3', '游明朝', 'Yu Mincho', '游明朝体', 'YuMincho', 'HGS明朝E', 'HG明朝E', 'MS P明朝', 'MS PMincho', serif; -} - -.taketori-serif-zh-tw { - font-family: 'Apple LiSung', PMingLiu, '新細明體', serif !important; -} - -.taketori-cursive-ja-jp { - font-family: 'DFP行書体', 'DF行書体', 'AGENDA人名行書体L1', 'HGP行書体', 'HGS行書体', 'HG行書体', Garamond, 'Times New Roman', 'ヒラギノ明朝 Pro W3', 'Hiragino Mincho Pro', 'HiraMinProN-W3', '游明朝', 'Yu Mincho', '游明朝体', 'YuMincho', 'HGS明朝E', 'HG明朝E', 'MS P明朝', 'MS PMincho', cursive; -} - -.taketori-cursive-zh-tw { - font-family: 'Apple LiSung', PMingLiu, '新細明體', serif !important; -} - -.taketori-kai-ja-jp { - font-family: 'DFP楷書体', 'HG正楷書体-PRO', Garamond, 'Times New Roman', 'ヒラギノ明朝 Pro W3', 'Hiragino Mincho Pro', 'HiraMinProN-W3', '游明朝', 'Yu Mincho', '游明朝体', 'YuMincho', 'HGS明朝E', 'HG明朝E', 'MS P明朝', 'MS PMincho', serif; -} - -.taketori-kai-zh-tw { - font-family: '教育部標準楷書', '全字庫正楷體', '標楷體', 'BiauKai', 'STKaiti', Kai, serif !important; -} - -.taketori-atsign-ja-jp, -.taketori-atsign-zh-tw { - font-family: '@MS 明朝' !important; -} - -.taketori-ttb { overflow: hidden; position: relative; } -.taketori-ttb span { cursor: vertical-text; } -.taketori-ttb a span { cursor: pointer !important; } - -.taketori-ttb .taketori-col { - -moz-transform-origin: left bottom; - -webkit-transform-origin: left bottom; - -o-transform-origin: left bottom; - transform-origin: left bottom; - -moz-transform:rotate(90deg); - -webkit-transform:rotate(90deg); - -o-transform:rotate(90deg); - transform:rotate(90deg); -} -.taketori-ttb .taketori-col span.cjk { - display: -moz-inline-block; - display: inline-block; -} -.taketori-ttb span.tcy { - min-width: 1em; - text-align: center !important; - cursor: text; -} -.taketori-ttb span.cjk, .taketori-ttb span.tcy, .taketori-ttb span.ltr { - display: -moz-inline-block; - display: inline-block; - -moz-transform:rotate(-90deg); - -webkit-transform:rotate(-90deg); - -o-transform:rotate(-90deg); - transform:rotate(-90deg); - vertical-align: middle !important; -} -.taketori-ttb span.cjk, .taketori-ttb span.tcy { - letter-spacing: 0 !important; -} -.taketori-ttb ruby rb, .taketori-ttb ruby rt { - line-height: 1; -} -.taketori-ttb img, -.taketori-ttb object, -.taketori-ttb embed, -.taketori-ttb video, -.taketori-ttb audio { - -moz-transform:rotate(-90deg); - -webkit-transform:rotate(-90deg); - -o-transform:rotate(-90deg); - transform:rotate(-90deg); - vertical-align: middle !important; -} - -.taketori-ttb .nocjk { - vertical-align: middle !important; -} - -.taketori-ttb .ltr { - -moz-transform:rotate(-90deg); - -webkit-transform:rotate(-90deg); - -o-transform:rotate(-90deg); - transform:rotate(-90deg); -} -.taketori-ttb .ltr span.cjk, .taketori-ttb .ltr span.tcy, .taketori-ttb .ltr span.ltr { - display: inline; - -moz-transform:none; - -webkit-transform:none; - -o-transform:none; - transform:none; - vertical-align: baseline !important; -} -.taketori-ttb .ltr span { - cursor: text; -} - -.taketori-ttb span.cho-on { - vertical-align: middle !important; - -moz-transform: scale(1.0,-1.0); - -webkit-transform: scale(1.0,-1.0); - -o-transform: scale(1.0,-1.0); - transform: scale(1.0,-1.0); -} -.taketori-ttb span.tou-ten { - margin: -0.64em 0.7em 0.64em -0.7em !important; -} -.taketori-ttb span.ku-ten { - margin: -0.6em 0.64em 0.6em -0.64em !important; -} -.taketori-ttb span.kogaki { - margin: -0.2em 0.15em 0.2em -0.15em !important; -} -.taketori-ttb span.kakko { - vertical-align: middle !important; -} -.taketori-ttb span.ku-ten, -.taketori-ttb span.tou-ten, -.taketori-ttb span.kogaki { - border: none !important; - background: transparent none !important; -} -.taketori-ttb span.kinsoku { - display: -moz-inline-block; - display: inline-block; -} - -.taketori-ttb .underline { - text-decoration: none !important; -} -.taketori-ttb .underline span.nocjk, .taketori-ttb .underline .ltr { - text-decoration: underline !important; -} -.taketori-ttb .underline span.cjk { - border-right: 1px solid; - line-height: 1; - margin: 0.25em -1px 0.25em 0; -} -.taketori-ttb .underline span.cho-on { - border-bottom: 1px solid; - border-right: none; - margin: 0.25em 0 0.25em 0; -} - -.taketori-ttb .overline { - text-decoration: none !important; -} -.taketori-ttb .overline span.nocjk, .taketori-ttb .overline .ltr { - text-decoration: overline !important; -} -.taketori-ttb .overline span.cjk { - border-left: 1px solid; - line-height: 1; - margin: 0.25em 0 0.25em -1px; -} -.taketori-ttb .overline span.cho-on { - border-top: 1px solid; - border-left: none; - margin: 0.25em 0 0.25em 0; -} - -.taketori-ttb .bothline { - text-decoration: none !important; -} -.taketori-ttb .bothline span.nocjk, .taketori-ttb .bothline .ltr { - text-decoration: underline overline !important; -} -.taketori-ttb .bothline span.cjk { - border-left: 1px solid; - border-right: 1px solid; - line-height: 1; - margin: 0.25em -1px 0.25em -1px; -} -.taketori-ttb .bothline span.cho-on { - border-top: 1px solid; - border-bottom: 1px solid; - border-left: none; - border-right: none; - margin: 0.25em 0 0.25em 0; -} - -.taketori-ttb del { - text-decoration: none; -} -.taketori-ttb del span.nocjk, .taketori-ttb del .ltr, .taketori-ttb .ltr del { - text-decoration: line-through; -} -.taketori-ttb del span.cjk:after { - content: "\2503"; - display: -moz-inline-block; - display: inline-block; - position: absolute; - top: 0; - left: 0; -} -.taketori-ttb del span.ku-ten:after, -.taketori-ttb del span.tou-ten:after { - content: ""; -} -.taketori-ttb del span.kogaki:after { - margin: 0.15em 0.2em -0.15em -0.2em; -} -.taketori-ttb del span.cho-on:after { - -moz-transform: scale(1.0,-1.0) rotate(-90deg); - -webkit-transform: scale(1.0,-1.0) rotate(-90deg); - -o-transform: scale(1.0,-1.0) rotate(-90deg); - transform: scale(1.0,-1.0) rotate(-90deg); -} - -.taketori-ttb .italic { - font-style: normal !important; -} -.taketori-ttb .italic span.nocjk, .taketori-ttb .italic .ltr { - font-style: italic !important; -} -.taketori-ttb .italic span.cjk { - -moz-transform:rotate(-90deg) skew(0,-20deg); - -webkit-transform:rotate(-90deg) skew(0,-20deg); - -o-transform:rotate(-90deg) skew(0,-20deg); - transform:rotate(-90deg) skew(0,-20deg); -} -.taketori-ttb .italic span.kakko { - display: -moz-inline-block; - display: inline-block; - -moz-transform:skew(20deg,0); - -webkit-transform:skew(20deg,0); - -o-transform:skew(20deg,0); - transform:skew(20deg,0); -} -.taketori-ttb .italic span.cho-on { - -moz-transform: scale(1.0,-1.0); - -webkit-transform: scale(1.0,-1.0); - -o-transform: scale(1.0,-1.0); - transform: scale(1.0,-1.0); - vertical-align: middle; -} - -.taketori-ttb strong { - font-weight: normal; -} -.taketori-ttb strong span.nocjk, .taketori-ttb strong .ltr, .taketori-ttb .ltr strong { - font-weight: bold; -} -.taketori-ttb strong span.cjk:after { - content: "\3001"; - display: -moz-inline-block; - display: inline-block; - position: absolute; - top: 0; - left: 0; - margin: -0.3em 0 0 1em; -} -.taketori-lang-ja-jp strong span.cjk:after { - margin: -0.3em 0 0 1em; -} -.taketori-lang-zh-tw strong span.cjk:after { - margin: 0 0 0 0.75em; -} - -.taketori-ttb strong span.ku-ten:after, -.taketori-ttb strong span.tou-ten:after { - content: ""; -} -.taketori-ttb strong span.kogaki:after { - margin: -0.15em 0 0 0.8em; -} -.taketori-lang-ja-jp strong span.kogaki:after { - margin: -0.15em 0 0 0.8em; -} -.taketori-lang-zh-tw strong span.kogaki:after { - margin: 0.15em 0 0 0.55em; -} -.taketori-ttb strong span.cho-on:after { - -moz-transform: scale(1.0,-1.0) rotate(-90deg); - -webkit-transform: scale(1.0,-1.0) rotate(-90deg); - -o-transform: scale(1.0,-1.0) rotate(-90deg); - transform: scale(1.0,-1.0) rotate(-90deg); - margin: 1em 0.3em -1em -0.3em; -} -.taketori-lang-ja-jp strong span.cho-on:after { - margin: 1em 0.3em -1em -0.3em; -} -.taketori-lang-zh-tw strong span.cho-on:after { - margin: 0.75em 0 -0.75em 0; -} - -.taketori-ttb ul.cjk, .taketori-ttb ol.cjk { - list-style-type: none; -} -.taketori-ttb ul.cjk li:before, .taketori-ttb ol.cjk li:before { - content: attr(data-marker); - display: -moz-inline-block; - display: inline-block; - width: 3em; - text-align: center; - margin: 0 -0.3em 0 -2.7em; - font-size: 0.8em; - -moz-transform:rotate(-90deg); - -webkit-transform:rotate(-90deg); - -o-transform:rotate(-90deg); - transform:rotate(-90deg); -} - -.taketori-ruby-disabled ruby { - display: -moz-inline-block; - display: inline-block; - position: relative; -} -.taketori-ruby-disabled ruby rp { - display: none; -} -.taketori-ruby-disabled ruby rt { - display: block; - margin: -1em 0 0 0; - font-size: 0.5em; - position: absolute; - top: 0; - left: 0; - vertical-align: bottom; -} - -/* Use Writing Mode */ -.taketori-writingmode-ttb .taketori-col { - -moz-writing-mode: vertical-rl; - -webkit-writing-mode: vertical-rl; - -o-writing-mode: vertical-rl; - -ms-writing-mode: tb-rl; - /writing-mode: tb-rl; - _writing-mode: tb-rl; -} -.taketori-writingmode-ttb .ltr, .taketori-writingmode-ttb span.tcy { - text-indent: 0 !important; - line-height: 1 !important; - -moz-writing-mode: horizontal-tb; - -webkit-writing-mode: horizontal-tb; - -o-writing-mode: horizontal-tb; - -ms-writing-mode: lr-tb; - /writing-mode: lr-tb; - _writing-mode: lr-tb; - vertical-align: middle\9; -} -.taketori-writingmode-ttb span.tcy { - letter-spacing: 0 !important; -} - -.taketori-writingmode-ttb .underline { - text-decoration: overline; -} - -.taketori-writingmode-ttb .overline { - text-decoration: underline; -} - -.taketori-writingmode-ttb strong.bo-ten { - font-weight: normal; - -webkit-text-emphasis-style: filled; - -moz-text-emphasis-style: filled; - -o-text-emphasis-style: filled; - -ms-text-emphasis-style: filled; - text-emphasis-style: filled; -} -.taketori-writingmode-ttb strong.bo-ten span.cjk { - display: inline-block; -} -.taketori-writingmode-ttb strong.bo-ten span.cjk:after { - content: "\3001"; - display: inline-block; - line-height: 1; - position: absolute; - margin: -0.55em -0.05em 0.55em 0.05em; -} -.taketori-lang-ja-jp strong.bo-ten span.cjk:after { - margin: -0.55em -0.05em 0.55em 0.05em; -} -.taketori-lang-zh-tw strong.bo-ten span.cjk:after { - margin: -1em 0.25em 1em -0.25em; -} - -.taketori-writingmode-ttb ul.cjk, .taketori-writingmode-ttb ol.cjk { - list-style-type: none; -} -.taketori-writingmode-ttb ul.cjk li:before, .taketori-writingmode-ttb ol.cjk li:before { - display: -moz-inline-block; - display: inline-block; - content: attr(data-marker); - -moz-writing-mode: horizontal-tb; - -webkit-writing-mode: horizontal-tb; - -o-writing-mode: horizontal-tb; - -ms-writing-mode: lr-tb; - /writing-mode: lr-tb; - _writing-mode: lr-tb; - font-size: 0.8em; - line-height: 1; - margin: -1.2em 0 0.2em -0.2em; - text-align: center; - vertical-align: text-bottom; -} - -.taketori-in-progress { - opacity: 0 !important; - -moz-opacity: 0 !important; - -webkit-opacity: 0 !important; - -o-opacity: 0 !important; - -ms-filter: "alpha(opacity=0)" !important; - filter: alpha(opacity=0) !important; -} - diff --git a/app/src/main/assets/taketori.js b/app/src/main/assets/taketori.js deleted file mode 100644 index 1899f145..00000000 --- a/app/src/main/assets/taketori.js +++ /dev/null @@ -1,1687 +0,0 @@ -/* Taketori - Make Text Vertical - * Copyright 2010-2015 CMONOS Co. Ltd. (http://cmonos.jp) - * - * Version: 1.4.4 - * Lisence: MIT Lisence - * Last-Modified: 2015-11-08 - */ - - -var TaketoriDblClickAlert = { // should be unicode entity for Opera. - 'ja-jp' : "\uFEFF\u7E26\u66F8\u304D\u5316\u3057\u305F\u3044\u90E8\u5206\u3092\u30C0\u30D6\u30EB\u30AF\u30EA\u30C3\u30AF\u3057\u3066\u304F\u3060\u3055\u3044\u3002", - 'zh-tw' : "\u9ede\u5169\u4e0b\u4ee5\u5207\u63db\u5230\u76f4\u6392\u986f\u793a\u3002", - 'zh-cn' : "Double click to make text vertical.", - 'ko-kr' : "Double click to make text vertical." -}; -var TaketoriDefaultLang = (document.getElementsByTagName('html')[0] && document.getElementsByTagName('html')[0].lang) ? - (document.getElementsByTagName('html')[0].lang.search(/tw/i) != -1) ? "zh-tw" -// : (document.getElementsByTagName('html')[0].lang.search(/(zh|cn)/i) != -1) ? "zh-cn" -// : (document.getElementsByTagName('html')[0].lang.search(/(ko|kr)/i) != -1) ? "ko-kr" - : "ja-jp" - : "ja-jp"; -//var TaketoriDefaultLang = "ja-jp"; // or .. simply set your language. - -var TaketoriTool = function () {}; -TaketoriTool.prototype = { - - element : function(element) { - if (arguments.length > 1) element = Array.prototype.slice.call(arguments); - this.elements = new Array(); - return this.appendElement(element); - }, - - list : function () { return (this.elements) ? this.elements : [] }, - - appendElement : function(element) { - if (arguments.length > 1) element = Array.prototype.slice.call(arguments); - if (!element) return this; - if (!this.elements) this.elements = new Array(); - if (element.constructor == Array) { - for (var i=0; i 30)) - || typeof (document.createElement('div')).style.OWritingMode != 'undefined' - ) ? true : false), - isMultiColumnReady : (( - typeof (document.createElement('div')).style.MozColumnWidth != 'undefined' - || typeof (document.createElement('div')).style.webkitColumnWidth != 'undefined' - || (typeof (document.createElement('div')).style.webkitWritingMode != 'undefined' && typeof (document.createElement('div')).style.webkitColumnWidth != 'undefined') - || typeof (document.createElement('div')).style.OColumnWidth != 'undefined' - || typeof (document.createElement('div')).style.msColumnWidth != 'undefined' - || typeof (document.createElement('div')).style.columnWidth != 'undefined' - ) ? true : false), - isLegacy : ((navigator.appVersion.search(/MSIE/) != -1 - || typeof (document.createElement('div')).style.MozTransform != 'undefined' - || typeof (document.createElement('div')).style.webkitTransform != 'undefined' - || typeof (document.createElement('div')).style.OTransform != 'undefined' - || typeof (document.createElement('div')).style.transform != 'undefined') ? false : true), - isTextEmphasisReady : (( - typeof (document.createElement('div')).style.MozTextEmphasisStyle != 'undefined' - || typeof (document.createElement('div')).style.webkitTextEmphasisStyle != 'undefined' - || typeof (document.createElement('div')).style.OTextEmphasisStyle != 'undefined' - || typeof (document.createElement('div')).style.msTextEmphasisStyle != 'undefined' - || typeof (document.createElement('div')).style.textEmphasisStyle != 'undefined' - ) ? true : false), - supportTouch : ((((!window.navigator.msPointerEnabled && !window.navigator.pointerEnabled) || navigator.userAgent.search(/iphone|ipad|android/i) != -1) && ('createTouch' in document || 'ontouchstart' in document)) ? true : false), - - document : (new TaketoriTool()), - - importCSS : function() { - if (this.cssImported) return true; - this.cssImported = false; - var links = document.getElementsByTagName('link'); - for (var i=0; i'); - } - this.cssImported = true; - }, - - setTemporaryCSS : function(cssText) { - if (!this.temporaryStyle) { - this.temporaryStyle = document.createElement('style'); - this.temporaryStyle.setAttribute('type','text/css'); - document.getElementsByTagName('head')[0].appendChild(this.temporaryStyle); - } - this.temporaryStyle.appendChild(document.createTextNode(cssText)); - }, - - removeTemporaryCSS : function() { - if (this.temporaryStyle) { - document.getElementsByTagName('head')[0].removeChild(this.temporaryStyle); - this.temporaryStyle = null; - } - }, - - init : function() { - if (!this.windowWidth) { - var taketori = this; - this.document.element(window).addEventListener('resize', function () { - if (taketori.resizeTimer) clearTimeout(taketori.resizeTimer); - taketori.resizeTimer = setTimeout(function () { taketori.refresh(); },500); - }); - } - this.windowWidth = ((self.innerWidth) ? self.innerWidth : (document.compatMode != null && document.compatMode != "BackCompat") ? self.document.documentElement.clientWidth : self.document.body.clientWidth); - this.windowHeight = ((self.innerHeight) ? self.innerHeight : (document.compatMode != null && document.compatMode != "BackCompat") ? self.document.documentElement.clientHeight : self.document.body.clientHeight); - if (!this.isMSIE && this.rubyDisabled == null) { - if (!!window.opera) { - this.rubyDisabled = true; - } else { - var ruby = document.createElement('ruby'); - var rubyDisplay = this.getStyle(ruby).display; - this.rubyDisabled = (rubyDisplay == 'block') ? true : false; - } - } - }, - - set : function (hash) { - if (this.isLegacy) return this; - if (!this.config) this.config = {}; - if (hash != null) this.merge(this.config,hash); - if (this.config.lang) this.config.lang = this.config.lang.toLowerCase(); - return this; - }, - - merge : function (original,hash) { - if (!original) original = {}; - if (hash != null) { - for (var key in hash) { - if (hash[key] != null) { - if (hash[key].constructor == Array) { - this.merge(original[key],hash[key]); - } else if (typeof hash[key] == "string" || typeof hash[key] == "number" || typeof hash[key] == "boolean") { - original[key] = hash[key]; - } - } - } - } - return original; - }, - - element : function (element) { - if (this.isLegacy) return this; - if (arguments.length > 1) element = Array.prototype.slice.call(arguments); - if (!this.config.elements) this.config.elements = new Array(); - if (element && element.constructor == Array) { - for (var i=0; i 0) { - elements = elements.sort(function (a,b) { return b.readabilityScore - a.readabilityScore }); - var readableElements = new Array(); - for (var i=0; i').replace(/"/g,'"').replace(/&/g,'&'); - }, - - getCookie : function(name) { - var cookies = new Array(); - var cookiePairs = document.cookie.split(/;\s*/); - for (var i=0; i < cookiePairs.length; i++) { - if (cookiePairs[i] != "") { - var eq = cookiePairs[i].indexOf("="); - if (eq >= 0) { - var key = cookiePairs[i].substring(0, eq); - var value = cookiePairs[i].substring(eq+1, cookiePairs[i].length); - cookies[key] = value; - } - } - } - return (name != null && cookies[name] != null) ? cookies[name] : ""; - }, - - setCookie : function(name,value,expires) { - if (!expires) { - if (this.config.cookieExpires) { - expires = this.config.cookieExpires; - } else { - expires = new Date(); - expires.setTime(expires.getTime() + 86400000000); - } - } - document.cookie = name + '=' + value + '; expires=' + expires.toGMTString() + ';' + ((this.config.cookieDomain != null && this.config.cookieDomain != "") ? ' domain=' + this.config.cookieDomain + ';' : '') + ((this.config.cookiePath != null && this.config.cookiePath != "") ? ' path=' + this.config.cookiePath : ''); - }, - - deleteCookie : function(name) { - this.setCookie(name, '', new Date(70, 0, 1, 0, 0, 1)); - }, - - setOnLoad : function(func) { - if (this.isLegacy) return this; - if (typeof window.addEventListener == 'function') { - window.addEventListener('load', func, false); - } else if (typeof window.attachEvent == 'object') { - window.attachEvent('onload', ((!this.isMultiColumnReady) ? function () { setTimeout(func,600) } : func)); - } - return this; - }, - - getStyle : function(element) { - if (element.currentStyle) { - return element.currentStyle; - } else { - var style = document.defaultView.getComputedStyle(element, null); - var div = document.createElement('div'); - if (style.length) { - for (var i=0; i 0 && style.height && style.height.search(/\d+\.?\d*(px|em)/i) != -1 && parseInt(style.height) > 0) { - if (element.currentStyle || (style.cssFloat && style.cssFloat != 'none') || (style.display == 'inline-block')) { - swapWH = true; - } else { - temp.style.width = 'auto'; - temp.style.height = 'auto'; - } - } else if ((style.width && style.width.search(/\d+\.?\d*%/) != -1) || (style.height && style.height.search(/\d+\.?\d*%/) != -1)) { - temp.style.width = (style.height && style.height.search(/\d+\.?\d*%/) != -1) ? style.height : 'auto'; - temp.style.height = (style.width && style.width.search(/\d+\.?\d*%/) != -1) ? style.width : 'auto'; - } else { - if (style.width == '0px') temp.style.width = 'auto'; - if (style.height == '0px') temp.style.height = 'auto'; - } - } - if (!this.isWritingModeReady || swapWH || (this.isWritingModeReady && !cssTextOnly)) { - var mw = 0; - var mh = 0; - var noRotate = false; - if (this.isWritingModeReady) { - mw = this.getMarginSize([style.paddingLeft,style.paddingRight,style.borderLeftWidth,style.borderRightWidth]); - mh = this.getMarginSize([style.paddingTop,style.paddingBottom,style.borderTopWidth,style.borderBottomWidth]); - noRotate = true; - } else { - mw = this.getMarginSize([style.paddingTop,style.paddingBottom,style.borderTopWidth,style.borderBottomWidth]); - mh = this.getMarginSize([style.paddingLeft,style.paddingRight,style.borderLeftWidth,style.borderRightWidth]); - } - var w = (!isNaN(parseInt(style.width)) && parseInt(style.width) > 0) ? parseInt(style.width) : (element.width) ? element.width : (isBlock && element.offsetWidth) ? element.offsetWidth - ((noRotate) ? mw : mh) : null; - var h = (!isNaN(parseInt(style.height)) && parseInt(style.height) > 0) ? parseInt(style.height) : (element.height) ? element.height : (isBlock && element.offsetHeight) ? element.offsetHeight - ((noRotate) ? mh : mw) : null; - var resized = false; - if (!w || !h) { - var clone = (cssTextOnly) ? element.cloneNode(true) : temp; - this.makeClipboard(this.process.target,true); - this.clipboard.appendChild(clone); - w = (clone.offsetWidth) ? clone.offsetWidth - ((noRotate) ? mw : mh) : clone.clientWidth; - h = (clone.offsetHeight) ? clone.offsetHeight - ((noRotate) ? mh : mw) : clone.clientHeight; - this.clipboard.removeChild(clone); - } - if (!isNaN(w) && !isNaN(h)) { - w += mw; - h += mh; - if (h > this.process.config.height) { - w = parseInt(w * this.process.config.height / h); - h = this.process.config.height; - resized = true; - } - if (w > this.process.config.width) { - h = parseInt(h * this.process.config.width / w); - w = this.process.config.width; - resized = true; - } - if (resized || swapWH) { - var cw = w - mw; - var ch = h - mh; - if (swapWH) { - if (element.currentStyle || (style.display == 'inline-block')) { - temp.width = ch; - temp.style.width = ch + 'px'; - } else { - temp.style.width = 'auto'; - } - temp.height = cw; - temp.style.height = cw + 'px'; - } else { - temp.width = cw; - temp.height = ch; - temp.style.width = cw + 'px'; - temp.style.height = ch + 'px'; - if (resized && isBlock) temp.style.overflow = 'auto'; - } - } - } - } - temp.style.borderTopWidth = style.borderLeftWidth || 0; - temp.style.borderRightWidth = style.borderTopWidth || 0; - temp.style.borderBottomWidth = style.borderRightWidth || 0; - temp.style.borderLeftWidth = style.borderBottomWidth || 0; - temp.style.borderTopColor = style.borderLeftColor || ''; - temp.style.borderRightColor = style.borderTopColor || ''; - temp.style.borderBottomColor = style.borderRightColor || ''; - temp.style.borderLeftColor = style.borderBottomColor || ''; - temp.style.borderTopStyle = style.borderLeftStyle || 'none'; - temp.style.borderRightStyle = style.borderTopStyle || 'none'; - temp.style.borderBottomStyle = style.borderRightStyle || 'none'; - temp.style.borderLeftStyle = style.borderBottomStyle || 'none'; - if (isBlock || !cssTextOnly || (this.isWritingModeReady && (!this.isMSIE || this.isMSIE < 8))) { - temp.style.paddingTop = style.paddingLeft || 0; - temp.style.paddingRight = style.paddingTop || 0; - temp.style.paddingBottom = style.paddingRight || 0; - temp.style.paddingLeft = style.paddingBottom || 0; - } - if (this.isWritingModeReady) { - if (isBlock && cssTextOnly) { - temp.style.overflowX = (style.overflowY) ? style.overflowY : 'visible'; - temp.style.overflowY = (style.overflowX) ? style.overflowX : 'visible'; - } - if (style.backgroundPositionX || style.backgroundPositionY) { - temp.style.backgroundPositionX = (style.backgroundPositionY) ? (style.backgroundPositionY == 'top') ? 'left' : (style.backgroundPositionY == 'bottom') ? 'right' : style.backgroundPositionY : '50%'; - temp.style.backgroundPositionY = (style.backgroundPositionX) ? (style.backgroundPositionX == 'left') ? 'top' : (style.backgroundPositionX == 'right') ? 'bottom' : style.backgroundPositionX : '50%'; - } else if (style.backgroundPosition && style.backgroundPosition.search(/(\S+)\s+(\S)/) != -1) { - temp.style.backgroundPosition = RegExp.$2 + ' ' + RegExp.$1 + ';'; - } - if (isBlock || !cssTextOnly || !this.isMSIE || this.isMSIE < 8) { - temp.style.marginTop = style.marginLeft || 0; - temp.style.marginRight = style.marginTop || 0; - temp.style.marginBottom = style.marginRight || 0; - temp.style.marginLeft = style.marginBottom || 0; - } - } else { - temp.style.marginTop = parseInt(((style.marginTop && style.marginTop != 'auto') ? parseInt(style.marginTop) : 0) + ((w - h)/2)) + 'px'; - temp.style.marginRight = parseInt(((style.marginRight && style.marginRight != 'auto') ? parseInt(style.marginRight) : 0) + ((h - w)/2)) + 'px'; - temp.style.marginBottom = parseInt(((style.marginBottom && style.marginBottom != 'auto') ? parseInt(style.marginBottom) : 0) + ((w - h)/2)) + 'px'; - temp.style.marginLeft = parseInt(((style.marginLeft && style.marginLeft != 'auto') ? parseInt(style.marginLeft) : 0) + ((h - w)/2)) + 'px'; - if (style.backgroundPosition && style.backgroundPosition.search(/(\S+)\s+(\S)/) != -1) { - temp.style.backgroundPosition = RegExp.$2 + ' ' + RegExp.$1 + ';'; - } - } - return (cssTextOnly) ? temp.style.cssText + ';' + element.style.cssText : this.outerHTML(temp); - }, - - outerHTML : function(element) { - if (!element) return ''; - var div = document.createElement('div'); - div.appendChild(element.cloneNode(true)); - return div.innerHTML; - }, - - rotatedBlockAdditionalCSSText : function(w,h,g,o) { - if (g == null) g = 0; - if (this.isWritingModeReady) { - return 'width:' + h + 'px;' - + 'height:' + w + 'px;' - + ((g) ? ((this.isMSIE && this.isMSIE == 9) ? (!o) ? 'padding-right:' : 'margin-right:' : (!o) ? 'padding-bottom:' : 'margin-bottom:') + g + 'px;' : '') - + ((!o) ? 'position:relative;overflow:auto;overflow-x:auto;overflow-y:hidden;' : ''); - } else { - return 'width:' + w + 'px;' - + 'height:' + h + 'px;' - + 'margin-top:-' + h + 'px;' - + 'margin-right:' + (h - w - g) + 'px;' - + 'margin-bottom:' + (w + g) + 'px;' - + 'margin-left:0;' - + ((!o) ? 'padding-right:'+g+'px;overflow:auto;overflow-x:visible;overflow-y:auto;' : ''); - } - }, - - toVertical : function(wait,currentConfig) { - if (this.isLegacy) return this; - var taketori = this; - if (wait == null || wait) { - this.importCSS(); - this.setOnLoad(function () { taketori.toVertical(false,currentConfig) }); - } else if (!this.cssImported) { - this.importCSS(); - setTimeout(function () { taketori.toVertical(false,currentConfig) },120); - } else { - var setDblClickEvent = false; - var setOnly = false; - if (!this.targetElements) { - if (!this.config.elements || this.config.elements[0] == '=auto') { - this.targetElements = this.japaneseReadableElements((this.config.minScore == null) ? 3 : this.config.minScore); - this.config.togglable = false; - setDblClickEvent = true; - } else if (this.config.elements[0] == '=dblclick') { - setOnly = setDblClickEvent = true; - } else { - var targets = this.document.element(this.config.elements).list(); - this.targetElements = new Array(); - for (var i=0; i 50 || Math.abs(taketori.touchY - e.pageY) > 50) clicked = false; - } - taketori.touchX = e.pageX; - taketori.touchY = e.pageY; - if (!clicked) { - taketori.dblClickTimer = setTimeout(function () { - if (taketori.dblClickTimer) delete taketori.dblClickTimer; - if (taketori.touchX) delete taketori.touchX; - if (taketori.touchY) delete taketori.touchY; - },500); - return; - } - } - taketori.toggle(taketori.lookUpBlockElements(e.target || e.srcElement)); - taketori.document.stopPropagation(e); - taketori.document.preventDefault(e); - }); - this.toggleEventAttached = true; - } - if (setOnly) { - var user_lang = navigator.browserLanguage || navigator.language || navigator.userLanguage; - user_lang = (user_lang.search(/tw/i) != -1) ? "zh-tw" : - (user_lang.search(/(zh|cn)/i) != -1) ? "zh-cn" : - (user_lang.search(/(ko|kr)/i) != -1) ? "ko-kr" : "ja-jp"; - alert(TaketoriDblClickAlert[user_lang]); - return this; - } - } - if (this.ttbDisabled == null) this.ttbDisabled = (this.getCookie('TTB_DISABLED') == 'true') ? true : false; - if (this.config.togglable) { - if (!this.config.cookieDomain) this.config.cookieDomain = document.domain; - if (!this.config.cookiePath) this.config.cookiePath = '/'; - for(var i=0; i 1) ? true : false; - e = e.touches[0]; - if (clicked) { - clearTimeout(element.taketori.dblClickTimer); - delete element.taketori.dblClickTimer; - if (is_not_tap || Math.abs(element.taketori.touchX - e.pageX) > 50 || Math.abs(element.taketori.touchY - e.pageY) > 50) clicked = false; - } - element.taketori.touchX = e.pageX; - element.taketori.touchY = e.pageY; - if (!clicked) { - if (!is_not_tap) element.taketori.dblClickTimer = setTimeout(function () { - if (element.taketori.dblClickTimer) delete element.taketori.dblClickTimer; - if (element.taketori.touchX) delete element.taketori.touchX; - if (element.taketori.touchY) delete element.taketori.touchY; - },500); - return; - } - } - taketori.document.stopPropagation(e); - taketori.document.preventDefault(e); - if (taketori.ttbDisabled) { - taketori.deleteCookie('TTB_DISABLED'); - taketori.ttbDisabled = false; - } else { - taketori.setCookie('TTB_DISABLED','true'); - taketori.ttbDisabled = true; - } - taketori.toVertical(false); - }); - element.taketori.toggleEventAttached = true; - } - this.toggle(element,this.ttbDisabled,true); - } - } else if (!this.ttbDisabled) { - for(var i=0; i this.windowHeight) ? this.windowWidth : this.windowHeight; - this.clipboard.style.top = '-' + (boardSize + 100) + 'px'; - this.clipboard.style.left = '-' + (boardSize + 100) + 'px'; - this.clipboard.style.width = boardSize + 'px'; - this.clipboard.style.height = boardSize + 'px'; - this.clipboard.style.overflow = 'auto'; - } - }, - - removeClipboard : function () { - if (this.temporaryContent) this.temporaryContent.parentNode.removeChild(this.temporaryContent); - if (this.clipboard) this.clipboard.parentNode.removeChild(this.clipboard); - this.clipboard = null; - this.temporaryContent = null; - }, - - toPx : function (value,fontSize,isLineHeight,parentSize) { - return (!value) ? 0 : (isLineHeight) ? ((value.search(/(\d+\.\d+)/) != -1) ? parseInt(RegExp.$1 * fontSize) : parseInt(1.5 * fontSize)) : (value.search(/\d+\.?\d*em/i) != -1) ? parseInt(parseFloat(value) * fontSize) : (value.search(/\d+\.?\d*%/) != -1) ? parseInt(parseFloat(value) * ((parentSize) ? parentSize : fontSize) / 100) : (value.search(/\d/) != -1) ? parseInt(value) : value; - }, - - getFontSize : function (fontSize) { - if (!isNaN(fontSize) || fontSize.search(/\d+px/) != -1) { - return parseInt(fontSize); - } else { - var bodyFontSize = (this.getStyle(document.body)).fontSize; - bodyFontSize = (bodyFontSize.search(/\d+\.?\d*(em|%)/) != -1) ? this.toPx(bodyFontSize,16) : parseInt(bodyFontSize); - fontSize = this.toPx(fontSize,bodyFontSize); - return (fontSize > 0) ? fontSize : 16; - } - }, - - setCurrentConfig : function (element,currentConfig) { - if (!currentConfig) currentConfig = this.configClone(this.config); - if (!currentConfig.classNameImported) { - var className = element.className; - if (className) { - var configNames = ['width','height','fontFamily','maxHeight','multiColumnEnabled','gap','contentWidth','contentHeight','lang']; - for(var i=0; i maxHeight) ? maxHeight : windowSize; - } - } else if (this.process.config.contentHeight && this.process.config.multiColumnEnabled) { - var h = this.toPx(currentConfig.height,fontSize); - this.process.config.columnCount = Math.ceil(this.process.config.contentHeight / (h+this.process.config.gap)); - this.process.config.height = parseInt((this.process.config.contentHeight + this.process.config.gap) / this.process.config.columnCount) - this.process.config.gap; - } else if (currentConfig.height && currentConfig.height == 'width') { - this.process.config.height = this.process.config.width; - } else if (!this.process.config.multiColumnEnabled) { - this.process.config.height = this.process.config.contentHeight || this.toPx(currentConfig.height,fontSize); - } else { - this.process.config.height = this.toPx(currentConfig.height,fontSize); - } - this.process.currentConfig = currentConfig; - return this; - }, - - getElementWidth : function (element,style) { - return ((element.offsetWidth) ? element.offsetWidth : element.scrollWidth) - this.getMarginSize([style.paddingLeft,style.paddingRight,style.borderLeftWidth,style.borderRightWidth]); - }, - - getMarginSize : function (v) { - var n = 0; - for (var i=0; i 1) { - var columnTotalHeight = this.process.config.width * this.process.config.columnCount; - if (this.process.width + 50 < columnTotalHeight) { - this.setTemporaryContentStyle(); - this.temporaryContent.innerHTML = content; - this.process.width = this.getTemporaryContentWidth(); - } - if (this.process.width + 50 >= columnTotalHeight) { - height = this.getMultiColumnWidth(content); - hasToBreak = (height > this.process.config.contentHeight) ? true : false; - } - } else if (this.isWritingModeReady) { - this.temporaryContent.style.height = this.process.config.contentHeight + 'px'; - this.temporaryContent.innerHTML = content; - this.process.width = this.temporaryContent.scrollWidth || this.temporaryContent.clientWidth || this.temporaryContent.offsetWidth; - hasToBreak = (this.process.width > this.process.config.contentWidth) ? true : false; - } else { - this.temporaryContent.style.width = this.process.config.contentHeight + 'px'; - this.temporaryContent.innerHTML = content; - this.process.width = this.temporaryContent.scrollHeight || this.temporaryContent.clientHeight || this.temporaryContent.offsetHeight; - hasToBreak = (this.process.width > this.process.config.contentWidth) ? true : false; - } - this.clipboard.className = ''; - return hasToBreak; - }, - - getMultiColumnWidth : function (content) { - if (!this.temporaryContent) { - this.temporaryContent = document.createElement('div'); - this.clipboard.appendChild(this.temporaryContent); - } - var width = 0; - this.setTaketoriClassName(this.clipboard); - this.setMultiColumnStyle(this.temporaryContent); - this.temporaryContent.innerHTML = content; - width = (this.isWritingModeReady) ? this.getTotalHeight(this.temporaryContent) : this.getTotalWidth(this.temporaryContent); - this.clipboard.className = ''; - return width; - }, - - setMultiColumnStyle : function (element) { - element.className = 'taketori-col taketori-multi-column'; - element.style.overflow = 'auto'; - if (this.isWritingModeReady) { - element.style.width = this.process.config.width + 'px'; - element.style.height = this.process.config.height + 'px'; - } else { - element.style.width = this.process.config.height + 'px'; - element.style.height = this.process.config.width + 'px'; - } - element.style.MozColumnWidth = this.process.config.height + 'px'; - element.style.webkitColumnWidth = this.process.config.height + 'px'; - element.style.OColumnWidth = this.process.config.height + 'px'; - element.style.msColumnWidth = this.process.config.height + 'px'; - element.style.columnWidth = this.process.config.height + 'px'; - element.style.MozColumnGap = this.process.config.gap + 'px'; - element.style.webkitColumnGap = this.process.config.gap + 'px'; - element.style.OColumnGap = this.process.config.gap + 'px'; - element.style.msColumnGap = this.process.config.gap + 'px'; - element.style.columnGap = this.process.config.gap + 'px'; - element.style.MozColumnFill = 'auto'; - element.style.webkitColumnFill = 'auto'; - element.style.OColumnFill = 'auto'; - element.style.msColumnFill = 'auto'; - element.style.columnFill = 'auto'; - }, - - setMultiColumnWidth : function (element) { - if (this.isWritingModeReady) { - var h = this.getTotalHeight(element); - element.style.height = h + 'px'; - element.style.overflow = 'auto'; - this.fixMargin(element,this.process.config.width,h); - setTimeout( function () { element.style.height = element.scrollHeight + 'px'; element.style.overflow = 'visible'; }, 120); - } else { - var w = this.getTotalWidth(element); - element.style.width = w + 'px'; - element.style.overflow = 'auto'; - this.fixMargin(element,w,this.process.config.width); - setTimeout( function () { element.style.width = element.scrollWidth + 'px'; element.style.overflow = 'visible'; }, 120); - } - }, - - getTotalWidth : function (element) { - var w = element.scrollWidth || element.clientWidth || element.offsetWidth; - return Math.ceil(w / (this.process.config.height + this.process.config.gap)) * (this.process.config.height + this.process.config.gap) - this.process.config.gap; - }, - - getTotalHeight : function (element) { - var h = element.scrollHeight || element.clientHeight || element.offsetHeight; - return Math.ceil(h / (this.process.config.height + this.process.config.gap)) * (this.process.config.height + this.process.config.gap) - this.process.config.gap; - }, - - setTaketoriClassName : function (element) { - var className = (this.isWritingModeReady) ? 'taketori-writingmode-ttb' : 'taketori-ttb'; - if (this.rubyDisabled) className += ' taketori-ruby-disabled'; - if (!this.isTextEmphasisReady) className += ' taketori-text-emphasis-disabled'; - className += ( - (this.isWritingModeReady && navigator.userAgent.search(/WebKit/i) != -1 && navigator.userAgent.search(/Windows/i) != -1) ? ' taketori-atsign' : - (!this.process.currentConfig.fontFamily) ? ' taketori-serif' : - (this.process.currentConfig.fontFamily == 'sans-serif') ? ' taketori-sans-serif' : - (this.process.currentConfig.fontFamily == 'cursive') ? ' taketori-cursive' : - (this.process.currentConfig.fontFamily == 'kai') ? ' taketori-kai' : - ' taketori-serif' - ) + '-' + this.process.currentConfig.lang; - className += ' taketori-lang-' + this.process.currentConfig.lang; - element.className += ((element.className) ? ' ' : '') + className; - }, - - removeTaketoriClassName : function (element) { - this.document.element(element).removeClassName('taketori-ttb').removeClassName('taketori-writingmode-ttb').removeClassName('taketori-ruby-disabled').removeClassName('taketori-(lang|serif|sans-serif|cursive|kai)[\\w\\-]*'); - }, - - make : function(element,configReady) { - this.document.element(element).addClassName('taketori-in-progress'); - var taketori = this; - setTimeout( function () { - if (!configReady) taketori.setCurrentConfig(element); - taketori.makeClipboard(element); - taketori.parse(element,true); - taketori.complement(); - taketori.removeClipboard(); - taketori.document.element(element).removeClassName('taketori-in-progress'); - },120); - }, - - isSkipClass : function (element) { - if (this.config.skipClass && element.className) { - for (var i=0; i < this.config.skipClass.length; i++) { - var regexp = new RegExp("(^|\\s)"+this.config.skipClass[i]+"(?![\\w\\-])"); - if (this.elements.className.search(regexp) != -1) { - return true; - } - } - } - return false; - }, - - isSkipId : function (element) { - return (this.config.skipId && element.id && this.isIncludedIn(this.config.skipId,thisNode.id)) ? true : false; - }, - - parse : function(thisNode,isRoot) { - if (thisNode == this.clipboard) return; - if (thisNode.taketori && thisNode.taketori.ttb) this.toggle(thisNode,true,true); - var tag = thisNode.nodeName.toLowerCase(); - var openTag = ''; - var closeTag = ''; - var attrText = ''; - var cssText = ''; - var className = ''; - var text = ''; - var isList = false; - var nodeType = thisNode.nodeType; - var lineMarginHeight = null; - var clearLineMarginHeight = false; - var hasChildNodes = thisNode.hasChildNodes && thisNode.hasChildNodes(); - switch (nodeType) { - case 1: - var nodeStyle = this.getStyle(thisNode); - if (this.process.isBreakable) { - var fontSize = this.getFontSize(nodeStyle.fontSize); - this.process.lineHeight = this.toPx(nodeStyle.lineHeight,fontSize,true); - if (!this.process.lineLength) this.process.lineLength = this.process.config.height; - if (!isRoot && nodeStyle.display == 'block') { - var parentLineLength = this.process.lineLength; - this.process.lineLength -= this.getMarginSize([nodeStyle.marginTop,nodeStyle.marginBottom,nodeStyle.paddingTop,nodeStyle.paddingBottom,nodeStyle.borderTopWidth,nodeStyle.borderBottomWidth]); - if (this.process.lineLength < fontSize) this.process.lineLength = fontSize; - } - this.process.roughFormula = fontSize * this.process.lineHeight / this.process.lineLength; - } - this.process.letterSpacing = this.letterSpacing(nodeStyle) || 0; - if (!isRoot) { - if (this.isIncludedIn(['img','object','embed','video','audio','textarea'],tag)) { - this.appendHTML(this.counterClockwiseRotatedOuterHTML(thisNode,nodeStyle)); - return; - } else if (this.isSkipClass(thisNode) || this.isSkipId(thisNode)) { - this.appendHTML(this.counterClockwiseRotatedOuterHTML(thisNode,nodeStyle)); - return; - } else if (this.isIncludedIn(['link','meta','base','script','style','map'],tag)) { - this.process.columnHTML += this.outerHTML(thisNode); - return; - } else if (tag == '!') { - return; - } else if (this.isIncludedIn(['br','input','select','option'],tag) || (this.isMSIE && this.isMSIE < 8 && tag == 'table')) { - this.appendHTML(this.outerHTML(thisNode)); - return; - } - var attributes = thisNode.attributes; - var setLtr = false; - var setKenten = false; - for (var i=0;i 7)) { - if (tag == 'li' && this.process.listStyleType && this.process.listStyleType[this.process.listStyleType.length-1] != '') { - attrText += ' data-marker="'+this.getListMarkerText()+'"'; - } - if (tag == 'ul' || tag == 'ol') { - isList = true; - this.process.listStart[this.process.listStart.length] = 0; - var listStyleType = nodeStyle.listStyleType.toLowerCase(); - if (this.isIncludedIn(['none','disc','circle','square'],listStyleType)) { - this.process.listStyleType[this.process.listStyleType.length] = ''; - } else { - this.process.listStyleType[this.process.listStyleType.length] = listStyleType; - className += ((className) ? ' ' : '') + 'cjk'; - } - } - if (this.isWritingModeReady) { - if (tag == 'strong') { - if (!this.isTextEmphasisReady) { - if (!this.process.kenten) setKenten = true; - this.process.kenten = true; - } - className += ((className) ? ' ' : '') + 'bo-ten'; - } - } - if (!this.isWritingModeReady && nodeStyle.fontStyle && nodeStyle.fontStyle.toLowerCase() == 'italic' && hasChildNodes) { - className += ((className) ? ' ' : '') + 'italic'; - } - if (nodeStyle.textDecoration && hasChildNodes) { - var textDecoration = nodeStyle.textDecoration.toLowerCase(); - if (textDecoration != 'none') { - if (textDecoration.search(/underline/i) != -1 && textDecoration.search(/overline/i) != -1) { - className += ((className) ? ' ' : '') + 'bothline'; - lineMarginHeight = this.lineMarginHeight(nodeStyle); - } else if (textDecoration.search(/underline/i) != -1) { - className += ((className) ? ' ' : '') + 'underline'; - lineMarginHeight = this.lineMarginHeight(nodeStyle); - } else if (textDecoration.search(/overline/i) != -1) { - className += ((className) ? ' ' : '') + 'overline'; - lineMarginHeight = this.lineMarginHeight(nodeStyle); - } - if (!this.isWritingModeReady && lineMarginHeight) { - if (!this.process.lineMarginHeight) clearLineMarginHeight = true; - this.process.lineMarginHeight = lineMarginHeight; - } - } - } - } - if (className) attrText += ' class="'+className+'"'; - if (cssText) attrText += ' style="'+cssText+'"'; - if (!isRoot) openTag += '<'+tag+attrText; - } - if (!hasChildNodes) { - if (!isRoot) { - openTag += '>'; - this.process.columnHTML += openTag; - } - } else { - if (!isRoot) { - this.process.columnHTML += openTag + '>'; - if (isList) openTag += ' start=""'; - openTag += '>'; - closeTag = ''; - this.process.openTags[this.process.openTags.length] = openTag; - this.process.closeTags[this.process.closeTags.length] = tag; - } - for (var i=0; izenkaku - text = text.replace(/([^\u0000-\u10FF]\s*[0-9]{2}|^\s*[0-9]{2})\s*([a-zA-Z]{1,2})(?=\s*[^\u0000-\u10FF]|$)/g,function (a,p,w) {return p + w.replace(/./g, function (c) {return String.fromCharCode(c.charCodeAt(0) + 65248)})});//hankaku->zenkaku - var taketori = this; - var count = 0; - text.replace(/&#?\w+;|\s+|./g,function (w) { - - //CJK - if (w.search(/^[\u1100-\u11FF\u2030-\u217F\u2460-\u24FF\u2600-\u261B\u2620-\u277F\u2E80-\u2FDF\u2FF0-\u4DBF\u4E00-\u9FFF\uA960-\uA97F\uAC00-\uD7AF\uD7B0-\uD7FF\uF900-\uFAFF\uFE30-\uFE4F\uFF00\uFF01\uFF03-\uFF06\uFF08-\uFF0C\uFF0E-\uFF1B\uFF1F-\uFF3D\uFF40-\uFF5B\uFF5D-\uFFEF]$/) != -1) { - taketori.setCJK(); - if (taketori.process.currentConfig.zh && taketori.isWritingModeReady && !taketori.process.ltr && (w == "\uFF1A" || w == "\uFF1B")) { - w = '' + w + ''; - } else if ((!taketori.isWritingModeReady || taketori.process.kenten) && !taketori.process.ltr) { - w = taketori.kinsokuShori('' + w + ''); - } - count++; - - //space - } else if (w.search(/^\s+$/) != -1) { - if (count > 0) count+=0.5; - - //NoCJK - } else { - if (w.search(/^[0-9a-zA-Z]$/) != -1) { - count+=0.5; - taketori.process.latin++; - } else { - count++; - taketori.process.latin = 0; - } - if (taketori.process.noCJK == 0) w = '' + w; - if (!this.isTextEmphasisReady) taketori.process.noCJK++; - } - if (!taketori.process.isBreakable || (count > 1 && taketori.isNoBreak(taketori.process.width + (count * taketori.process.roughFormula) + taketori.process.lineHeight))) { - taketori.process.columnHTML += w; - } else { - count = 1; - taketori.appendHTML(w); - } - }); - this.setCJK(); - break; - } - }, - - isNoBreak : function (h) { - if (this.isWritingModeReady || !this.process.isMultiColumnEnabled) { - return (h < this.process.config.width) ? true : false; - } else if (this.process.config.contentHeight && this.process.config.contentWidth) { - if (this.process.config.columnCount && this.process.config.columnCount > 1) { - return (h + 50 < this.process.config.width * this.process.config.columnCount) ? true : false; - } else { - return (h < this.process.config.contentHeight) ? true : false; - } - } else { - return true; - } - }, - - setCJK : function () { - if (this.process.noCJK > 0) { - this.process.columnHTML = ((this.process.noCJK == this.process.latin && this.process.latin <= 2) ? this.process.columnHTML.replace('','') : this.process.columnHTML.replace('','')) + ''; - } - this.process.latin = this.process.noCJK = 0; - }, - - lineMarginHeight : function (nodeStyle) { - var lineHeight = nodeStyle.lineHeight; - var fontSize = this.getFontSize(nodeStyle.fontSize); - if (lineHeight.search(/\d+px/i) != -1) { - return parseInt((parseInt(lineHeight) - fontSize) / 2); - } else if (lineHeight.search(/\d+%/) != -1) { - return parseInt(((parseInt(lineHeight) / 100) * fontSize - fontSize) / 2); - } else { - return parseInt((parseFloat(lineHeight) * fontSize - fontSize) / 2); - } - }, - - letterSpacing : function (nodeStyle) { - var letterSpacing = nodeStyle.letterSpacing; - if (letterSpacing.search(/normal/i) != -1) { - return 0; - } else if (letterSpacing.search(/\d+px/i) != -1) { - return parseInt(letterSpacing); - } else { - var fontSize = this.getFontSize(nodeStyle.fontSize); - if (letterSpacing.search(/\d+%/) != -1) { - return parseInt((parseInt(letterSpacing) / 100) * fontSize); - } else { - return parseInt(parseFloat(letterSpacing) * fontSize); - } - } - }, - - getListMarkerText : function () { - var n = ++this.process.listStart[this.process.listStart.length-1]; - var listType = this.process.listStyleType[this.process.listStyleType.length-1]; - var list; - if (listType == "A" || listType == "\u30A2" || listType == "upper-latin" || listType == "katakana") { - list = ["\u30A2","\u30A2","\u30A4","\u30A6","\u30A8","\u30AA","\u30AB","\u30AD","\u30AF","\u30B1","\u30B3","\u30B5","\u30B7","\u30B9","\u30BB","\u30BD","\u30BF","\u30C1","\u30C4","\u30C6","\u30C8","\u30CA","\u30CB","\u30CC","\u30CD","\u30CE","\u30CF","\u30D2","\u30D5","\u30D8","\u30DB","\u30DE","\u30DF","\u30E0","\u30E1","\u30E2","\u30E4","\u30E6","\u30E8","\u30E9","\u30EA","\u30EB","\u30EC","\u30ED","\u30EF","\u30F0","\u30F1","\u30F2","\u30F3"]; - return "(" + list[n] + ")"; - } else if (listType == "a" || listType == "\u3042" || listType == "lower-latin" || listType == "hiragana") { - list = ["\u3042","\u3042","\u3044","\u3046","\u3048","\u304A","\u304B","\u304D","\u304F","\u3051","\u3053","\u3055","\u3057","\u3059","\u305B","\u305D","\u305F","\u3061","\u3064","\u3066","\u3068","\u306A","\u306B","\u306C","\u306D","\u306E","\u306F","\u3072","\u3075","\u3078","\u307B","\u307E","\u307F","\u3080","\u3081","\u3082","\u3084","\u3086","\u3088","\u3089","\u308A","\u308B","\u308C","\u308D","\u308F","\u3090","\u3091","\u3092","\u3093"]; - return "(" + list[n] + ")"; - } else if (listType == "\u30A4" || listType == "katakana-iroha") { - list = ["\u30A4","\u30A4","\u30ED","\u30CF","\u30CB","\u30DB","\u30D8","\u30C8","\u30C1","\u30EA","\u30CC","\u30EB","\u30F2","\u30EF","\u30AB","\u30E8","\u30BF","\u30EC","\u30BD","\u30C4","\u30CD","\u30CA","\u30E9","\u30E0","\u30A6","\u30F0","\u30CE","\u30AA","\u30AF","\u30E4","\u30DE","\u30B1","\u30D5","\u30B3","\u30A8","\u30C6","\u30A2","\u30B5","\u30AD","\u30E6","\u30E1","\u30DF","\u30B7","\u30F1","\u30D2","\u30E2","\u30BB","\u30B9"]; - return "(" + list[n] + ")"; - } else if (listType == "\u3044" || listType == "hiragana-iroha") { - list = ["\u3044","\u3044","\u308D","\u306F","\u306B","\u307B","\u3078","\u3068","\u3061","\u308A","\u306C","\u308B","\u3092","\u308F","\u304B","\u3088","\u305F","\u308C","\u305D","\u3064","\u306D","\u306A","\u3089","\u3080","\u3046","\u3090","\u306E","\u304A","\u304F","\u3084","\u307E","\u3051","\u3075","\u3053","\u3048","\u3066","\u3042","\u3055","\u304D","\u3086","\u3081","\u307F","\u3057","\u3091","\u3072","\u3082","\u305B","\u3059"]; - return "(" + list[n] + ")"; - } else if (listType == "I" || listType == "upper-roman") { - list = ["I","I","II","III","IV","V","VI","VII","VIII","IX","X","XI","XII","XIII","XIV","XV","XVI","XVII","XVIII","XIX","XX"]; - return "(" + list[n] + ")"; - } else if (listType == "i" || listType == "lower-roman") { - list = ["i","i","ii","iii","iv","v","vi","vii","viii","ix","x","xi","xii","xiii","xiv","xv","xvi","xvii","xviii","xix","xx"]; - return "(" + list[n] + ")"; - } else if (listType == "1" || listType == "decimal" || listType == "\u4E00" || listType == "cjk-ideographic" || listType == "\u58F1") { - if (n <= 10) { - list = (listType == "\u58F1") ? ["\u58F1","\u58F1","\u5F10","\u53C2","\u56DB","\u4F0D","\u516D","\u4E03","\u516B","\u4E5D","\u62FE"] : ["\u4E00","\u4E00","\u4E8C","\u4E09","\u56DB","\u4E94","\u516D","\u4E03","\u516B","\u4E5D","\u5341"]; - return '(' + list[n] + ')'; - } else { - return '(' + n + ')'; - } - } else { - return ""; - } - }, - - appendHTML : function (w,isTerminated) { - var html = ''; - if (w == null) w = ''; - if ((isTerminated || this.process.isBreakable) && this.process.columnHTML != '') { - if ((this.isWritingModeReady && !this.isMultiColumnReady) || !this.process.isMultiColumnEnabled) { - if (isTerminated) { - html = this.columnComplement(); - } else { - html = this.columnComplement(this.process.columnHTML + w); - } - if (isTerminated || this.process.config.width < this.getWidth(html)) { - if (!isTerminated) html = this.columnComplement(); - this.process.content += '
' + html + '
'; - this.process.columnCount++; - if (isTerminated || (this.process.config.columnCount && this.process.config.columnCount == this.process.columnCount)) this.containerBreak(); - } - } else if (this.process.config.contentHeight && this.process.config.contentWidth) { - if (isTerminated) { - html = this.columnComplement(); - } else { - html = this.columnComplement(this.process.columnHTML + w); - } - if (isTerminated || this.hasToBreak(html)) { - if (!isTerminated) html = this.columnComplement(); - if (this.process.config.columnCount && this.process.config.columnCount > 1) { - this.process.content += '
' + html + '
'; - } else { - this.process.content += '
' + html + '
'; - } - this.containerBreak(); - } - } else if (isTerminated) { - this.process.content = document.createElement('div'); - this.setMultiColumnStyle(this.process.content) - this.process.content.innerHTML = this.columnComplement() - this.containerBreak(); - this.setMultiColumnWidth(this.process.target.firstChild) - } - } - this.process.columnHTML += w; - }, - - columnComplement : function (column) { - var isTrueColumn = false; - var html = ''; - if (column == null) { - html = this.process.columnHTML + ((this.process.noCJK > 1) ? '
' : '');; - isTrueColumn = true; - } else { - html = column + ((this.process.noCJK) ? '
' : ''); - } - if (isTrueColumn) { - this.process.columnHTML = ''; - this.process.width = 0; - if (this.process.noCJK) this.process.noCJK = 1; - if (this.process.latin) this.process.latin = 1; - } - var closeTags = ''; - var openTags = this.process.openTagsHTML; - var isNewItem = true; - for (var i=this.process.closeTags.length-1; i>=0; i--) { - var closeTag = this.process.closeTags[i]; - var regexp = new RegExp("<"+closeTag+"(?!\\w)[^>]*>\\s*$"); - if (html.search(regexp) == -1) { - closeTags += ''; - } else if (closeTags == '') { - html = html.replace(regexp,''); - if (closeTag == 'li') isNewItem = false; - } - } - if (isTrueColumn) { - this.process.openTagsHTML = this.process.openTags.join(''); - if (isNewItem) this.process.openTagsHTML = this.process.openTagsHTML.replace(/ data-marker=".*?"/g,''); - for (var i=0; i]*class="cjk"[^>]*>.<\/span>)$/,''); - if (RegExp.$1) w = '' + RegExp.$1 + w + ''; - this.process.kinsoku = null; - } - return w; - }, - - complement : function () { - this.appendHTML('',true); - }, - - containerBreak : function () { - if (typeof this.process.config.onbreak == 'function') { - this.process.config.onbreak(this); - } else { - this._containerBreak(); - } - }, - - _containerBreak : function () { - if (this.process.target) { - this.removeClipboard(); - if (!this.process.target.taketori) this.process.target.taketori = {}; - if (!this.process.config.contentWidth || !this.process.config.contentHeight || !this.process.done) { - var alt = this.process.target.innerHTML; - this.setTaketoriClassName(this.process.target); - if (typeof this.process.content == 'object') { - this.process.target.innerHTML = ''; - this.process.target.appendChild(this.process.content); - } else { - this.process.target.innerHTML = this.process.content; - var columnNode = this.process.target.firstChild; - var taketori = this; - var h = this.process.config.width; - var g = this.process.config.gap; - setTimeout(function () { - if (taketori.isWritingModeReady) { - if (columnNode.clientHeight < columnNode.scrollHeight) { - columnNode.style.height = columnNode.scrollHeight + 'px'; - } - } else { - if (columnNode.clientWidth < columnNode.scrollWidth) { - var w = columnNode.scrollWidth; - columnNode.style.width = w + 'px'; - taketori.fixMargin(columnNode,w,h,g,taketori.process.config.multiColumnEnabled); - } - } - },600); - } - if (this.process.config.contentWidth && this.process.config.contentHeight) this.process.done = true; - this.process.content = ''; - this.process.target.taketori.ttb = true; - this.process.target.taketori.alt = alt; - this.process.target.taketori.config = this.configClone(this.process.currentConfig); - this.process.target.taketori.clientWidth = this.process.target.clientWidth; - this.process.target.taketori.windowHeight = this.windowHeight; - } - this.makeClipboard(this.process.target); - } - }, - - fixMargin : function (rotatedNode,w,h,g,o) { - if (!g) g = 0; - if (this.isWritingModeReady) { - if (g) { - if (!o) { - rotatedNode.style.paddingBottom = g + 'px'; - } else { - rotatedNode.style.marginBottom = g + 'px'; - } - } - } else { - rotatedNode.style.marginTop = '-' + h + 'px'; - rotatedNode.style.marginRight = (h - w - g) + 'px'; - rotatedNode.style.marginBottom = (w + g) + 'px'; - rotatedNode.style.marginLeft = 0; - if (!o && g) rotatedNode.style.paddingRight = g + 'px'; - } - }, - - refresh : function () { - if (this.isLegacy) return this; - this.init(); - for(var i=0; i