內容簡介
Annotation WP 插件提供一個使用者友好的短代碼封裝 jQuery UI 工具提示小工具和標準 UI 主題。對於那些需要簡單而美觀的工具提示的使用者,默認提供了開箱即用的功能。對於需要更多對工具提示外觀和風格進行控制的使用者,提供了高級自定義指令。這些自定義設置也可以獨立應用於每個標注。可以使用文本和圖像作為錨點,並在內容中自由使用 HTML。
文檔
標註標記可以採用兩種形式,只有內容聲明不同。
[annotate id = "" text = "" img = "" content = "" theme = "" style = ""]
或者更優雅地,
[annotate id = "" text = "" img = "" theme = "" style = ""]<文本> [/annotate]
如果內容中包含 HTML 標記,應使用後一種形式。
Id
id 提供標注一個機制以在內容呈現中區分多個標注。如果沒有它,標注無法設置工具提示的主題或風格。如果包含 id,則 id 應該足夠獨特,以避免在單個帖子中發生衝突。否則,一個標注將優先於另一個標注。如果未提供 id,則忽略主題和風格並在內容中放置內聯內容(對於文本錨點使用標題屬性,對於圖像錨點使用 alt 屬性),其中的標記 [在內容中] 被視為原始文本。
內容
這是將出現在工具提示彈出窗口的內容。它可以指定為屬性或位於短碼分隔符之間。它可以是文本、圖像或兩者混合。使用 HTML 時,內容是允許的,但需要提供 id,並且內容應該出現在短碼的分隔符之間。否則,HTML 將出現為工具提示彈出窗口中的原始文本。對於簡單文本,請將內容保留為屬性並跳過指定 id,因為此操作會提高網站的性能。
文本
文本屬性設置用於標記的文本。文本的 CSS 屬性應該在標註短碼指令之外指定。通常,遵循以下格式:
‘[annotation text=”archival”]’
如果提供了 img 屬性,則忽略文本。必須提供文本或 img 屬性,否則將忽略標註。
圖像
可以使用不同大小的圖像代替標記的文本。與文本屬性一樣,可以在標註短碼之外指定 CSS。如果 img 和 text 都提供,則忽略文本屬性。如果未提供 img 或 text 屬性,則忽略標註。
主題
儘管 WordPress 提供了大多數 jQuery UI 實現,但未提供任何主題。這些 CSS 文件的缺失導致某些小部件無法按預期工作或沒有默認的外觀和風格。對於最新版本的 jQuery UI(1.10.3)和 WordPress 使用的目標版本的這些 CSS 主題包,在 Annotation 插件中都包含了這些 CSS 主題包。Annotation 可以根據佇列的 jQuery UI JavaScript 選擇正確的版本。用戶不應嘗試覆蓋此行為。當未指定主題屬性時,主題默認為 Cupertino。
用戶主題
用戶可以在 Annotation 主題目錄下安裝自己的主題(http://jqueryui.com/themeroller/)。確保為所有有效版本包括 css 文件,並仔細選擇名稱以避免衝突或格式錯誤的 URL。請注意,任何更新都將刪除這些主題,因此請按需要進行備份。
風格
xxx 保留
外掛標籤
開發者團隊
原文外掛簡介
The Annotation WP plugin provides a user friendly shortcode wrapper for the jQuery UI ToolTip Widget as well as the standard UI themes. Default functionality is provided out-of-the-box for those who require simple, yet aestechtically pleasing tooltips. For those who need more control over the look-and-feel of the tooltip, advanced customization directives are available. Customizations can also be applied independently to each annotation. Both text and images can be used for anchors and HTML can be used freely in content.
Documentation
Annotation mark-up can take two forms differing only in content declaration.
[annotate id="" text="" img="" content="" theme="" style=""]
or, more elegantly,
[annotate id="" text="" img="" theme="" style=""]
The latter should be used if HTML mark-up is included in the content.
Id
The id provides Annotation a mechanism to distinguish between multiple annotations in content rendering. Without it, Annotation can not set a theme or style for the tooltip. If included, id’s should at the very least be unique enough not to conflict in a single post. Otherwise one annotation will take precedence over the other. If id is not provided, theme and style are ignored and content is placed inline (using the title attribute for a text anchor, alt for image anchor), with mark-up [in content ]treated as raw text.
Content
This is the content that will appear in the tooltip pop-up window. It can be specified either as an attribute or between the shortcode delimiters. It can be text, an image, or a mixture of the two. When using… HTML is allowed, but [in this situation,] an id is required and the content should appear between shortcode delimiters. By not doing so, the HTML will appear as raw text in the pop-up. For simple text, do keep the content as an attribute and skip specifing an id as this will yield a small gain in performance for your website.
Text
The text attribute sets the text used for the anchor. CSS properties for the text should be specified outside of the annotation shortcode directives. Typically, the following format is followed:
‘[annotation text=”archival”]’
If the img attribute is provided, text is ignored. Either text or img must be provided, otherwise the annotation is ignored.
Image
Images of varying sizes can be used in place of text for the anchor. As with the text attribute, CSS can be specified outside of the annotation shortcode. If img and text are both provided, the text attribute is ignored. If no img or text attributes are provided, the annotation is ignored.
Themes
While WordPress makes avialable the majority of the jQuery UI implementation, it fails to provide any themes. The resultant lack of these CSS files is that some of the widgets do not work as expected and/or have no default look-and-feel. These CSS theme packages are included in the Annotation plugin for both the latest version of jQuery UI (1.10.3) and the targeted version of jQuery UI used by WordPress (1.9.2 as of this writing). Annotation is able to choose the correct version based on the enqueued jQuery UI JavaScript. Users should not attempt to override this behavior. The theme defaults to cupertino when the theme attribute is not specified.
User Themes
Users are welcome to install their own rolled themes (http://jqueryui.com/themeroller/) under the Annotation themes directory. Be sure to include css files for all working versions and choose the name carefully to avoid conflicts or malformed URLs. Be aware that any updates will remove these themes, so please make back-ups as appropriate.
Style
xxx Keep in mind that the style attribute applies to the tooltip, not the anchor. CSS for the anchor can be set outside of the annotation using span. The style attribute is particularly important in that it allows you to change aspects of the container for the tooltip. Most often, users will want to use this to set the maximum width of the tooltip or minor adjustments to the underlying theme. Styling for the tooltip content can be accomplished using mark-up in the content. JQuery UI elements require JSON encoded CSS which imposes some limitations on the style properties that you can specify. Color names cannot be used. Instead use rgb or rgba. DOM names are not necessary, however. See future for more details.
Future
JQuery UI Effects are not currently supported. However, if there is sufficient interest in their usage, this may change. It is also expected that interest in jQuery UI themes may result in a shortcode or option to include a specific theme for use by other jQuery UI widgets. Or, perhaps, the Annotation plugin may evolve to include all jQuery UI widgets.
Currently, a simple converter is provided for CSS text to JSON encoded CSS properties. A full conversion utility would inevitably create code bloat for this plugin and the inherit limitations are considered trivial. For these reasons, the gains from such a conversion utility are not deemed significant enough to warrant it’s implementation.
