@@ -5312,6 +5312,28 @@ function module_code(library_namespace) {
53125312 safari : 5
53135313 } ) ;
53145314
5315+ function pre_text_to_HTML ( pre_text ) {
5316+ return pre_text . replace ( / < [ \/ \w ] [ ^ < > ] * > | [ \n ] / g, function (
5317+ text_to_escape ) {
5318+ if ( text_to_escape . startsWith ( '<' ) ) {
5319+ if ( ! / < (?: a ) / . test ( text_to_escape )
5320+ //
5321+ && ! / \s t a r g e t = / . test ( text_to_escape ) ) {
5322+ text_to_escape = text_to_escape
5323+ //
5324+ . replace ( / > $ / , ' target="_blank">' ) ;
5325+ }
5326+ return text_to_escape ;
5327+ }
5328+
5329+ // 以不換行(pre)的方式顯示.patch
5330+ return {
5331+ ' ' : ' ' ,
5332+ '\n' : '<br />'
5333+ } [ text_to_escape ] ;
5334+ } ) ;
5335+ }
5336+
53155337 // TODO: 點選文字後在下方出現全橫幅的layer以展示訊息,再點選可隱藏。
53165338 // e.g.,
53175339 // https://www.twreporter.org/a/bookreview-i-generation-discrimination-micro-aggression
@@ -5630,30 +5652,11 @@ function module_code(library_namespace) {
56305652 //
56315653 ? '<div id="s" style="color:#488;background-color:#FF8;">\n'
56325654 //
5633- + oPos . innerHTML . replace ( / \n / g, '<br />' )
5634- //
5635- . replace ( / / g, ' ' ) + '\n<\/div><hr />' : '' )
5655+ + pre_text_to_HTML ( oPos . innerHTML ) + '\n<\/div><hr />' : '' )
56365656
56375657 + '<div id="c" style="color:#404;background-color:#8FF;">\n'
56385658
5639- + oTxt . replace ( / < [ \/ \w ] [ ^ < > ] * > | [ \n ] / g, function ( text_to_escape ) {
5640- if ( text_to_escape . startsWith ( '<' ) ) {
5641- if ( ! / < \/ / . test ( text_to_escape )
5642- //
5643- && ! / \s t a r g e t = / . test ( text_to_escape ) ) {
5644- text_to_escape = text_to_escape
5645- //
5646- . replace ( / > $ / , ' target="_blank">' ) ;
5647- }
5648- return text_to_escape ;
5649- }
5650-
5651- // 以不換行(pre)的方式顯示.patch
5652- return {
5653- ' ' : ' ' ,
5654- '\n' : '<br />'
5655- } [ text_to_escape ] ;
5656- } )
5659+ + pre_text_to_HTML ( oTxt )
56575660
56585661 + '\n<\/div><hr />'
56595662
@@ -5663,6 +5666,7 @@ function module_code(library_namespace) {
56635666 //
56645667 + sPopP . close_message + '<\/b> ]'
56655668 // + '</body></html>'
5669+ ;
56665670
56675671 w . document . open ( ) ;
56685672 w . document . write ( t ) ;
@@ -5679,6 +5683,9 @@ function module_code(library_namespace) {
56795683 return popup_window_type ;
56805684 }
56815685
5686+ // 警告: 這是個暫時性的 hook,用在 review html files。可能改為 CeL.set_up_popup() 之類。
5687+ _ . sPop = sPop ;
5688+
56825689 /**
56835690 * <code> 開啟連結於 target
56845691 ** 最好將openAtInit();設在onload
0 commit comments