FANDOM


翻譯尚未完成

此頁面或部分內容仍未翻譯,請將其翻譯成適當的語言(中文)

ReferencePopups 是一種維基的引用來源顯示工具。效果是只要把游標停在引用上,就會出現來源內容的浮動框。讀者不用再拉到頁面底部就可以直接看到引用的內容。

來源彈窗還有顏色功能,不需另外設CSS它就會自動配合維基的主題顏色。不過你還是可以用Special:ThemeDesigner來設定它;在使用CSS改變維基主題色的情況下,ThemeDesigner可能無法正常運作。

安裝

您正在導入多項腳本?這個快速指引能幫助您合併import聲明。
  • 若使用於個別維基,管理員可以至wiki的MediaWiki:ImportJS頁面添加以下程式碼。
dev:ReferencePopups/code.js
  • 若供個人使用,請至個人化global.js頁面(運作於整個Fandom)添加以下代碼片段,或至個別維基的個人化common.js頁面(運作於單一維基)。
importArticles({
    type: 'script',
    articles: [
        'u:dev:MediaWiki:ReferencePopups/code.js',
    ]
});

使用說明

可以使用此工具內建的UI。你可以設定點擊開啟、滑鼠逗留多久開啟及關閉彈窗開關的動畫效果。你也可以直接把這個功能關掉,每個用戶的設定都不會影響到其他用戶。 即使彈窗停止運作,還是能在分類下找到彈窗的UI設定行,點擊UI就能重新設定彈窗。

彈窗結構

彈窗結構有下列幾個選項:

  • 關閉來源彈窗(Disable Reference Popups)-這會永久地關閉彈窗功能。使用文章下的「設置來源彈窗(Configure Reference Popups)」能重新開啟。某些Wiki會鎖住彈窗以避免讀者把它關掉。你可以連絡個別維基的管理員。
  • 游標暫留(Hover delay)-可以設定滑鼠需要在引用上停留多少時間(設定以毫秒為單位)才能打開彈窗。預設為200毫秒。請注意,設定時間太短的話會非常干擾閱讀。
  • 再次觸碰才會消失(Make popups stay open until touched with the mouse)-彈窗一出現後、直到游標再次經過前都不會消失。這樣就不用讓游標一直停在引用記號上。
  • 開啟方式(Activate by)-在預設中需要游標停留才能開啟彈窗;可以切換成滑鼠點擊開啟彈窗。在滑鼠點擊模式中,彈窗開啟時再次點擊引用就能關掉它,但你也會因此被移動到文章下方的參考來源。
  • 開關動畫(Enable Open/Close Animations)-彈窗在預設中有開啟/關閉的動畫(約300毫秒)。一般來說比起直接開啟,這樣對眼睛比較好。但如果不在意的話,你可以關掉它。

Administrator Configuration

Administrators can remove the gadget's configuration link from their wiki by putting Reference Popups into "lockdown" mode. This will force the popups to stay enabled and remove the configuration link from the end of the article, but not from the popup itself.

To enable lockdown, just add this to MediaWiki:Common.js above the aforementioned import:

((window.dev = window.dev || {}).ReferencePopups = dev.ReferencePopups || {}).lockdown = true;

You can also alter the defaults for new users. You can disable the animation by default using:

((window.dev = window.dev || {}).ReferencePopups = dev.ReferencePopups || {}).defaults = { animate: false };

Custom Popups

The popup component of this script is fully reusable and can be repurposed to display anything you want as well as references. A pre-made script and template set is provided if you just want something to drop in and use. Alternatively, if you are capable of writing your own JavaScript, you can instead code against the popups directly to do things like AJAX new content and display it in a popup as certain elements are interacted with.

To use the custom popups, you will need to import the Custom Popup script:

dev:ReferencePopups/custom.js

And you will need to copy these 2 templates onto your wiki to make use of the script:

The templates describe how to use them.

An important thing to note is that the custom popup script will use the user's ReferencePopup configuration even though the gear icon doesn't appear in custom ones. This means that if the popup is in click mode then attaching popups to page elements that already have their own scripts can have strange consequences. Unlike normal popups, custom ones are never sticky and can't be disabled though.

You can also construct custom skins for you custom popups as well. An example of this is on the demo page, you can see the CSS for it over here.

Community content is available under CC-BY-SA unless otherwise noted.

Fandom may earn an affiliate commission on sales made from links on this page.

Stream the best stories.

Fandom may earn an affiliate commission on sales made from links on this page.

Get Disney+