Clearbox3

25 views
Skip to first unread message

Dennis YMB

unread,
Sep 18, 2009, 8:12:59 AM9/18/09
to TiddlyWiki 華語支援論壇
大家好,我在PTW 已經有Lightbox2,
但我覺得Lightbox2不夠漂亮和效果,
請問有人可以幫我寫或教我如何製作plugin.js的Clearbox3輸入到PTW?
希望看到你們的答覆~
感謝你們!

Clearbox3:
http://www.clearbox.hu/index_en.html

BramChen

unread,
Sep 18, 2009, 11:13:10 AM9/18/09
to TiddlyWiki 華語支援論壇
Clearbox3 的確不錯,客製性相當高、功能多元、對 TW 有很好的「親和力」,撰寫專屬 plugin 應非屬必要。


摘要步驟如下:
1) MarkupPostHead 加入:
<!--{{{-->
<script type="text/javascript" src="YourPathTo/clearbox.js"></script>
<!--}}}-->


2) 以下方式擇一:
a) ViewTemplate 加入:
<span macro='tiddler - with:{{CB_Init();}}' />

b) 在內含 clearbox 內容之 tiddler 中加入:
<<tiddler - with:{{CB_Init();}}>>


3) 使用說明:
使用 <html> ... </html>,
於其內之 html 元素,例如 <a>、<div> ...,指定 rel=clearbox 藉以定義 clearbox 參數,
再以呼叫 CB_Init(); 調用。2)

範例:
<html><a class="button" href="http://www.clearbox.hu/index_en.html"
rel="clearbox[width=800 height=600]">更多使用說明與範例 ...</a> </html>


4) 範例演示
下載網址:
https://sourceforge.net/projects/ptw/files/

下載檔案:
Clearbox3.zh-Hant-2.5.3-090918.zip

摘要:
1) 簡單示範於關閉 Clearbox 後,呼叫自定 function。
2) 幻燈片展示
3) 內嵌網頁

其餘詳見
http://www.clearbox.hu/index_en.html

~She.Saran~

unread,
Sep 18, 2009, 11:20:45 AM9/18/09
to TiddlyWiki 華語支援論壇
诶`~
功能确实不错~
不过写代码却是件麻烦事。
如果可以将相应的代码做成 tw 标签 就好了

例如<<Vlear URL 描述 参数>> 之类滴宏扩展语言,应当更好使用,毕竟要输入一堆的代码,还是麻烦了些。。

> 其餘詳見http://www.clearbox.hu/index_en.html


>
> On 9月18日, 下午8時12分, Dennis YMB <dennis...@gmail.com> wrote:
>
>
>
> > 大家好,我在PTW 已經有Lightbox2,
> > 但我覺得Lightbox2不夠漂亮和效果,
> > 請問有人可以幫我寫或教我如何製作plugin.js的Clearbox3輸入到PTW?
> > 希望看到你們的答覆~
> > 感謝你們!
>

> > Clearbox3:http://www.clearbox.hu/index_en.html- 隱藏被引用文字 -
>
> - 顯示被引用文字 -

魚狗

unread,
Sep 18, 2009, 11:28:21 AM9/18/09
to tiddly...@googlegroups.com
這個真棒,感謝幾位分享,有空時就來用自己的網頁試看看~~

2009/9/18 BramChen <bram...@gmail.com>

BramChen

unread,
Sep 18, 2009, 12:00:17 PM9/18/09
to TiddlyWiki 華語支援論壇
補充說明:

clearbox3 的主程式 (CB_core.js) 經「壓縮」處理,其官網下載之壓縮檔未含「source code」,故「難以」得知其實際
處理方式。合理推測每次呼叫 CB_Init() 時,可能掃描顯示中的 html 元素,包含所有開啟中的 tiddlers 與其他如
MenuMain、SidebarTabs、...,處理具 rel=clearbox 屬性的 html tags 。

因此建議:
1)
使用前述摘要步驟 2) 之 b) 的方式。

2)
最好「關閉動畫顯示效果」。

3) 安裝套件:
SinglePageModePlugin 或 http://visualtw.ouvaton.org/VisualTW.html#TiddlersBarPlugin

SearchOptionsPlugin、YourSearchPlugin 或 SimpleSearchPlugin
( 詳見 http://tiddlywiki.org/wiki/Enhanced_Search )


應能減少可能的不良影響。


On 9月18日, 下午11時13分, BramChen <bram.c...@gmail.com> wrote:

> 其餘詳見http://www.clearbox.hu/index_en.html

Dennis YMB

unread,
Sep 18, 2009, 12:58:41 PM9/18/09
to TiddlyWiki 華語支援論壇
哇Thank you BramChen,
感謝BramChen這麼快已經有格式和示例使用Clearbox3

非常感謝!

BramChen

unread,
Sep 21, 2009, 4:18:09 AM9/21/09
to TiddlyWiki 華語支援論壇
新範例下載:
https://sourceforge.net/projects/ptw/files/

檔名:
Clearbox3.zh-Hant-2.5.3-090921.zip


摘要說明如下:

1) MarkupPostHead 改為:
<script type="text/javascript" src="common/clearbox.js?dir=common/
clearbox&lng=zh-Hant">

原 cleabox.js 與 CB_Config.js 還原為官網下載的原樣。亦即,除新增的 zh-Hant(s).js 的語系檔外,餘皆同
clearbox 官網版本。

切換語系與設定程式庫所在資料夾,改由參數傳遞。(clearbox.js 既有之功能)


2) 新增一個小小增益集 (ClearboxAddon),稍稍增進使用的便利性,並修正隱含的小問題。
CB_Init() 改由 ClearboxAddon 呼叫,並自動移除呼叫該 function 後,重複建立的 divs。

欲更改 CB_* 參數設定或啟用 CB_* functions,可自行增加 scripts 設定之。

這是一個配合第三方程式庫應的增益集小範例,只需善用 TW 內建功能,及幾行簡單的 javascripts ,便能簡化輸入的簡易應用,僅供參
考。

若用於更多圖檔的展示,可利用 tiddler slices、 tag 的功能延伸擴充之,可能需要多些 scripts,有興趣的話可以試試。


3) 修正範例錯誤:
[width=800 height=600] ==> [width=800,,height=600]
註: rel=clearbox[params] 此語法中的個參數間須以「雙逗號」(,,)區隔。

On 9月19日, 上午12時58分, Dennis YMB <dennis...@gmail.com> wrote:
> 哇Thank you BramChen,
> 感謝BramChen這麼快已經有格式和示例使用Clearbox3
>
> 非常感謝!

Dennis YMB

unread,
Sep 21, 2009, 4:58:46 AM9/21/09
to TiddlyWiki 華語支援論壇
Yes I have also found these few problem
1:)隱含的小問題 > CB_Init()
2:)範例錯誤:[width=800 height=600] ==> [width=800,,height=600]
good to hear you make this

若用於更多圖檔的展示,可利用 tiddler slices、 tag 的功能延伸擴充之,可能需要多些 scripts,有興趣的話可以試試。

Thank you so so so much Bram Chen!

Dennis YMB

unread,
Sep 21, 2009, 5:05:20 AM9/21/09
to TiddlyWiki 華語支援論壇
剛剛看到您的新樣本,
簡直是Javascript高手,
又快手, proud of you!

Dennis YMB

unread,
Sep 22, 2009, 4:33:00 AM9/22/09
to TiddlyWiki 華語支援論壇
When I install my SplashScreen, pop this:

執行巨集 <<tiddler>> 時,發生錯誤 :
Unable to evaluate {{CB_Init();}}: ReferenceError: CB_effektek is not
defined

BramChen

unread,
Sep 22, 2009, 5:14:32 AM9/22/09
to TiddlyWiki 華語支援論壇
該訊息應為 clearbox 程式庫未載入所致。

新版 TW 已內建 splash 功能,無需另行安裝 SplashScreen 套件。請參考:
http://bit.ly/info/iRndF


1) 請說明:
你如何安裝 SplashScreen

以及安裝 clearbox 、ClearboxAddon 的相關資訊


2) 請檢查 MarkupPostHead :


<script type="text/javascript" src="common/clearbox.js?dir=common/
clearbox&lng=zh-Hant">

確定 clearbox 所在路徑是否無誤。

Dennis YMB

unread,
Sep 23, 2009, 12:26:40 PM9/23/09
to TiddlyWiki 華語支援論壇
I finally found problem cause on old sample > ViewTemplate > <span
macro='tiddler - with:{{CB_Init();}}' />
that's why 執行巨集 <<tiddler>> 時,發生錯誤

NOW EVERYTHINGS FINE, thanks Chen Sir!

Dennis YMB

unread,
Sep 23, 2009, 1:41:54 PM9/23/09
to TiddlyWiki 華語支援論壇
AFTER POST THIS on MarkupPreHead
<!--{{{-->
<!-- Splash Screen -->
<div id="splashScreen" style="position:absolute; margin-top:10em;
margin-left:18em; width:20em; padding-left:7em; line-height:5em;
border:3px yellow; solid; color:blue; background:lightyellow;fona-size:
3em;">
<img src="images/loading02.gif" style="vertical-align:middle;padding:
6px"/>
載入中,請稍後 ....
</div>
<!--}}}-->

then Clearbox is not working

BramChen

unread,
Sep 23, 2009, 9:01:47 PM9/23/09
to TiddlyWiki 華語支援論壇

> I finally found problem cause on old sample > ViewTemplate > <span
> macro='tiddler - with:{{CB_Init();}}' />
> that's why 執行巨集 <<tiddler>> 時,發生錯誤

如前述:


2) 新增一個小小增益集 (ClearboxAddon),稍稍增進使用的便利性,並修正隱含的小問題。
CB_Init() 改由 ClearboxAddon 呼叫,並自動移除呼叫該 function 後,重複建立的 divs。

因此無須於使用時再另行調用 CB_Init();

若 clearbox 成功載入,雖安裝 ClearboxAddon ,舊範例應仍可常執行。

BramChen

unread,
Sep 23, 2009, 10:06:35 PM9/23/09
to TiddlyWiki 華語支援論壇

TW 內建的 splash screen 功能,其實只是在 TW 的 layout 未載入繪製前讓 borwser 先顯示 <div
id="splashScreen" ..> ...</div> 的內容,再於 StyleSheetLayout 中設定 css roule
#splashScreen{display:none;}。

(據知,某 SplashScreenPlugin 方法類似,未安裝測試,故不知其結果如何)


範例文件中係參照 clearbox 官網說明的使用方式,載入 clearbox:


<script type="text/javascript" src="common/clearbox.js?dir=common/

clearbox&lng=zh-Hant"></script>

clearbox.js 雖以對 TW 「不友善」的 document.write() 載入 cb_core.js 等。
但將其放在 MarkupPostHead (or MarkupPreHead) 執行,可在 TW layout 繪製前執行,方不致於「崩解」
TW。兩著


試著對調兩者宣告的前後順序,發現:
若 splashScreen 在前,則 clearbox 程式庫似無法正常載入。
反之,則 splash screen 無法顯示, clearbox 可正常調用。榮

若不使用 document.write() 改以其他方式的 javascript 動態加載cb_core.js 等 js files,情況亦
同。

由於 clearbox 未釋出原始碼,難以進一步偵錯。

(目前有到一個方式,但或需更動 TW core,且未必可行。再找時間測試 ...)


ClearboxAddon 僅 5 行 statements (其實可縮減為 2 行),應非肇事者。
尤其,相同問題也發生於僅直接使用 <html> 的方式。

很遺憾,僅能暫下結論:clearbox 與 splash screen 兩者不相容,請擇一使用。

Reply all
Reply to author
Forward
0 new messages