MediaWiki:Common.css

出自Quickpedia wiki

注意:在您發布之後,您可能需要清除瀏覽器快取才能看到變更。

  • Firefox或Safari:按住Shift時點擊重新整理,或按Ctrl-F5或Ctrl-R(Mac則為⌘-R)
  • Google Chrome:按Ctrl-Shift-R(Mac則為⌘-Shift-R)
  • Internet Explorer或Edge:按住Ctrl時點擊重新整理,或按Ctrl-F5
  • Opera:按Ctrl-F5。
/** CSS placed here will be applied to all skins */
/* Common CSS for all skins */

/* 致各管理員:留意 Monobook.css or Common.css 在 [[Wikimedia:zh:Wikipedia:Village Pump|Wikipedia:Village Pump]] 的變動。  Thank you. */
/*<pre><nowiki>*/

/* make the list of references look smaller */
ol.references {
   font-size: 100%;
}

.references-small { font-size: 90%;}

/* VALIDATOR NOTICE: the following is correct, but the W3C validator doesn't accept it */
/* -moz-* is a vendor-specific extension (CSS 2.1 4.1.2.1) */
/* column-count is from the CSS3 module "CSS Multi-column Layout" */
/* Please ignore any validator errors caused by these two lines */
.references-2column {
  font-size: 90%;
  -moz-column-count:2;
  column-count:2;
}

.same-bg { background: none }

/* wikitable/prettytable class for skinning normal tables */

table.wikitable,
table.prettytable {
  margin: 1em 1em 1em 0;
  background: #f9f9f9;
  border: 1px #aaaaaa solid;
  border-collapse: collapse;
}

table.wikitable th, table.wikitable td,
table.prettytable th, table.prettytable td {
  border: 1px #aaaaaa solid;
  padding: 0.2em;
}

table.wikitable th,
table.prettytable th {
  background: #f2f2f2;
  text-align: center;
}

table.wikitable caption,
table.prettytable caption {
  margin-left: inherit;
  margin-right: inherit;
}

/* Style for "notices" */
.notice {
    text-align: justify;
    margin: 1em;
    padding: 0.2em;
}

#disambig {
    border-top: 3px double #cccccc;
    border-bottom: 3px double #cccccc;
}

#spoiler {
    border-top: 2px solid #ddd;
    border-bottom:2px solid #ddd;
}

/* Standard talk template style */

.Talk-Notice {
    border: 1px solid #C0C090;
    background-color: #F8EABA;
    margin-bottom: 3px;
    width: 80%;
    border-spacing: 3px;
    margin-left: auto;
    margin-right: auto;
}

.Talk-Notice:after {
  content: "The CSS for this template should be changed. See [[Wikipedia:Template Standardisation]].";
}

/* Make template background appear correctly on all browsers */
.Talk-Notice td {
    background: inherit;
}

/* Metadata */
table.metadata {
    border: 1px solid #aaaaaa;
    display: none;
    speak: none;
}
.metadata-label {
    color: #aaaaaa;
}

/* Makes redirects appear in italics on [[Special:Allpages]] */
.allpagesredirect {
    font-style: italic;
}

/* Choose whether to have AD/BC dates or CE/BCE dates*/

/* First, the default : display both : See templates ADCE and BCEBC for how these are used*/
.Use_Default_Date_Convention { display: inline; }
.Use_AD_and_BC { display: none; }
.Use_BCE_and_CE { display: none; }

/* If you want to display AD and BC add the following to User:You/monobook.css page */
/*
.Use_Default_Date_Convention { display: none; }
.Use_AD_and_BC { display:inline; }
.Use_BCE_and_CE { display:none; }
*/

/*If you want to display CE and BCE add the following to User:You/monobook.css page */
/*
.Use_Default_Date_Convention { display: none; }
.Use_AD_and_BC { display:none; }
.Use_BCE_and_CE {display:inline; }
*/

/* Class for links with loudspeaker icon next to them */

.audiolink a{
    background: url("http://upload.wikimedia.org/wikipedia/commons/f/f7/Loudspeaker.png") center left no-repeat !important;
    padding-left: 16px !important;
    padding-right: 0 !important;
}

/* Icons for medialist templates [[Template:Listen]], [[Template:Multi-listen_start]], [[Template:Video]], [[Template:Multi-video_start]] */

div.listenlist {
    background: url("http://upload.wikimedia.org/wikipedia/commons/thumb/a/a6/Gnome-speakernotes.png/30px-Gnome-speakernotes.png");
    padding-left: 40px;
}

div.videolist {
    background: url("http://upload.wikimedia.org/wikipedia/commons/thumb/0/0e/Video.svg/40px-Video.svg.png");
    padding-left: 50px;
}

div.multivideolist {
    background: url("http://upload.wikimedia.org/wikipedia/en/thumb/7/7a/FilmRoll-small.png/40px-FilmRoll-small.png");
    padding-left: 50px;
}

/* Style rules for media list templates */

div.medialist {
    min-height: 50px;
    margin: 1em;
    background-position: top left;
    background-repeat: no-repeat;
}

div.medialist ul {
    list-style-type: none;
    list-style-image: none;
    margin: 0;
}

div.medialist ul li {
    padding-bottom: 0.5em;
}

div.medialist ul li li {
    font-size: 91%;
    padding-bottom: 0;
}

/*Add formatting to make sure that "external references" from [[Template:Ref]] do
  not get URL expansion, not even when printed. The mechanism up to MediaWiki 1.4 was
  that the HTML code contained a SPAN following the anchor A; this SPAN had the class
  "urlexpansion", which was not displayed on screen, but was shown when the medium was
  "print". The rules below ensure (a) that there is no extra padding to the right of
  the anchor (displayed as "[<number>]"), (b) that there is no "external link arrow" for
  the link, and (c) that this SPAN of class "urlexpansion" is never shown.
  [[使用者:Msnhinet8|Msnhinet8]]([[使用者討論:Msnhinet8|留言]]) 2025年4月8日 (二) 10:55 (CST)
*/

.plainlinksneverexpand {
  background: none ! important;
  padding: 0 ! important;
}

.plainlinksneverexpand .urlexpansion {
  display: none ! important;
}

/* Make sure that ext links displayed within "plainlinksneverexpand" don't get
   the arrow...
*/
.plainlinksneverexpand a {
   background: none !important;
   padding: 0 !important;
}

/* With MediaWiki 1.5, the mechanism has changed: instead of a SPAN of class "urlexpansion"
   following the anchor A, the anchor itself now has class "external autonumber" and the
   expansion is inserted when printing (see the common printing style sheet at
   http://en.wikipedia.org/skins-1.5/common/commonPrint.css) using the ":after" pseudo-
   element of CSS. We have to switch this off for links due to Template:Ref!
   [[使用者:Msnhinet8|Msnhinet8]]([[使用者討論:Msnhinet8|留言]]) 2025年4月8日 (二) 10:55 (CST)
*/
.plainlinksneverexpand a.external.text:after {
  display: none !important;
}
.plainlinksneverexpand a.external.autonumber:after {
  display: none !important;
}

/* Merge template style */

.messagebox {
   border: 1px solid #aaaaaa;
   background-color: #f9f9f9;
   width: 80%;
   margin: 0 auto 1em auto;
   padding: .2em;
   text-align: justify;
}
.messagebox.merge {
   border: 1px solid #cf9fff;
   background-color: #f5edf5;
   text-align: center;
}
.messagebox.cleanup {
   border: 1px solid #9f9fff;
   background-color: #efefff;
   text-align: center;
}
.messagebox.standard-talk {
   border: 1px solid #c0c090;
   background-color: #f8eaba;
}

/* Infobox template style */

.infobox {
   border: 1px solid #aaaaaa;
   background-color: #f9f9f9;
   color: black;
   margin-bottom: 0.5em;
   margin-left: 1em;
   padding: 0.2em;
   float: right;
   clear: right;
}
.infobox td,
.infobox th {
   vertical-align: top;
}
.infobox caption {
   font-size: larger;
   margin-left: inherit;
}
.infobox.bordered {
   border-collapse: collapse;
}
.infobox.bordered td,
.infobox.bordered th {
   border: 1px solid #aaaaaa;
}
.infobox.bordered .borderless td,
.infobox.bordered .borderless th {
   border: 0;
}

.infobox.sisterproject {
   width: 20em;
   font-size: 120%;
}

/* Support for Template:IPA, Template:Unicode and Template:Polytonic. The inherit declaration resets the font for all browsers except MSIE6.  The empty comment must remain. */
.IPA {
        font-family: Chrysanthi Unicode, Doulos SIL, Gentium, GentiumAlt, Code2000, TITUS Cyberbit Basic, DejaVu Sans, Bitstream Cyberbit, Arial Unicode MS, Lucida Sans Unicode, Hiragino Kaku Gothic Pro, Matrix Unicode;
        font-family /**/:inherit;
}
.Unicode {
        font-family: TITUS Cyberbit Basic, Code2000, Doulos SIL, Chrysanthi Unicode, Bitstream Cyberbit, Bitstream CyberBase, Thryomanes, Gentium, GentiumAlt, Visual Geez Unicode, Lucida Grande, Arial Unicode MS, Microsoft Sans Serif, Lucida Sans Unicode;
        font-family /**/:inherit;
}
.latinx {
        font-family: TITUS Cyberbit Basic, Code2000, Microsoft Sans Serif;
        font-family /**/:inherit;
}
.polytonic, .interwiki-el a {
        font-family: Athena, Gentium, Palatino Linotype, Arial Unicode MS, Lucida Sans Unicode, Lucida Grande, Code2000;
        font-family /**/:inherit;
}
.mufi {
        font-family: Alphabetum, Cardo, LeedsUni, Junicode, TITUS Cyberbit Basic, ALPHA-Demo;
}
.interwiki-ja a {
        font-family: "Meiryo", "MS PMincho", "MS Mincho", "MS PGothic", "MS Gothic", "Arial Unicode MS";
}
.interwiki-ko a {
        font-family: "Malgun Gothic", "Gulim", "Dotum", "Arial Unicode MS";
}
.interwiki-ru a, .interwiki-uk a, .interwiki-be a, .interwiki-bg a,
.interwiki-sr a, .interwiki-mk a, .interwiki-os a, .interwiki-tg a,
.interwiki-mo a,.interwiki-kk a, .interwiki-ky a, .interwiki-tt a,
.interwiki-ba a, .interwiki-cv a, .interwiki-mn a, .interwiki-xal a,
.interwiki-udm a,.interwiki-ab a, .interwiki-av a, .interwiki-ce a {
        /* 西里爾字母 */
        font-family: "Times CY", "Times New Roman", Times, serif;
}
.interwiki-ar a, .interwiki-fa a, .interwiki-ur a, .interwiki-ug a {
        /* 阿拉伯字母 */
        font-family: "Arial Unicode MS", "Microsoft Sans Serif", "Times New Roman", Times, serif;
        direction: rtl;
}
.interwiki-he a, .interwiki-yi a {
        /* 希伯來字母 */
        font-family: Cardo, "Arial Unicode MS", Code2000, David, "Times New Roman", Times, serif;
        direction: rtl;
}
.interwiki-af a, .interwiki-als a, .interwiki-an a, .interwiki-ang a,
.interwiki-ast a, .interwiki-az a, .interwiki-ba a, .interwiki-bat-smg a,
.interwiki-bm a, .interwiki-br a, .interwiki-bs a, .interwiki-ca a,
.interwiki-ceb a, .interwiki-co a, .interwiki-cs a, .interwiki-csb a,
.interwiki-cy a, .interwiki-da a, .interwiki-de a, .interwiki-en a,
.interwiki-eo a, .interwiki-es a, .interwiki-et a, .interwiki-eu a,
.interwiki-ff a, .interwiki-fi a, .interwiki-fiu-vro a, .interwiki-fo a,
.interwiki-fr a, .interwiki-frp a, .interwiki-fur a, .interwiki-fy a,
.interwiki-ga a, .interwiki-gd a, .interwiki-gl a, .interwiki-gv a,
.interwiki-ha a, .interwiki-hr a, .interwiki-ht a, .interwiki-hu a,
.interwiki-ia a, .interwiki-id a, .interwiki-ie a, .interwiki-ilo a,
.interwiki-io a, .interwiki-is a, .interwiki-it a, .interwiki-jbo a,
.interwiki-jv a, .interwiki-kg a, .interwiki-ksh a, .interwiki-ku a,
.interwiki-kw a, .interwiki-la a, .interwiki-lad a, .interwiki-lb a,
.interwiki-li a, .interwiki-lij a, .interwiki-lmo a, .interwiki-ln a,
.interwiki-lt a, .interwiki-lv a, .interwiki-map-bms a, .interwiki-mi a,
.interwiki-ms a, .interwiki-na a, .interwiki-nap a, .interwiki-nds a,
.interwiki-nl a, .interwiki-nn a, .interwiki-no a, .interwiki-nrm a,
.interwiki-oc a, .interwiki-om a, .interwiki-os a, .interwiki-pam a,
.interwiki-pl a, .interwiki-pms a, .interwiki-pt a, .interwiki-rm a,
.interwiki-ro a, .interwiki-sc a, .interwiki-scn a, .interwiki-sco a,
.interwiki-se a, .interwiki-simple a, .interwiki-sk a, .interwiki-sl a,
.interwiki-so a, .interwiki-sq a, .interwiki-su a, .interwiki-sv a,
.interwiki-sw a, .interwiki-tet a, .interwiki-tpi a, .interwiki-tk a,
.interwiki-tl a, .interwiki-tw a, .interwiki-tr a, .interwiki-uz a,
.interwiki-vec a, .interwiki-vi a, .interwiki-wa a, .interwiki-war a,
.interwiki-wo a, .interwiki-yo a, .interwiki-cdo a, .interwiki-zh-min-nan a {
        font-family: "Times New Roman", Times, serif;
}

#wpSave {
  font-weight: bold;
}

/* hiddenStructure from Monobook - allows selective hiding of markup in templates */
.hiddenStructure {
   display: none;
   speak: none;
}

/* Removes underlines from links */
.nounderlines a {
  text-decoration: none;
}

/* CSS for testing a new Main Page design, see [[Wikipedia:WikiProject Usability/Main Page]] */

#EnWpMainPage { width: 100%; margin-top: 1em; }
#EnWpMainPage h2 { font-size: 130%; font-weight: bold; margin: 0; padding: 0; border: 0; }
#EnWpMpMargin { margin-right: 13.8em; }
#EnWpMpCol1 { float: left; clear: left; width: 50%; }
#EnWpMpCol2 { width: 49.9%; float: left; }
#EnWpMpBrowse { background: #f8fcff url(http://upload.wikimedia.org/wikipedia/en/9/9f/MP-three-books.png) no-repeat 180% 9%; border: 1px solid #c7c7c7; }
#EnWpMpBrowseCats li { font-size: 85%; margin-left: 1em; line-height: 1.5; }
#EnWpMpBrowseCats h3 { font-size: 120%; margin: .2em 0 .1em -.8em; padding: 0; font-weight: normal; }
#EnWpMpBrowseCats h3 a { font-weight: bold; }
#EnWpMpBook { background-image: url(http://upload.wikimedia.org/wikipedia/en/7/7e/MP-open-book.png); }
#EnWpMpFeaturedPic { text-align: center; margin: 0 0 .5em; font-size: 85%; font-weight: bold; }
#EnWpMpFeaturedPic h2 { font-size: 145%; text-align: left; }
.EnWpMpBrowseRight { float: right; width: 12.7em; }
.EnWpMpBrowseBottom { margin: 1em 0; }
.EnWpMpBrowseBottom #EnWpMpBrowseCats li, .EnWpMpBrowseBottom #EnWpMpUsefulLinks, .EnWpMpBrowseBottom #EnWpMpFeaturedPic { float: left; width: 24%; margin: 0; line-height: normal; }
.EnWpMpBrowseBottom #EnWpMpBrowseCats h3 { margin-left: 0; }
#EnWpMpUsefulLinks { clear: left; }
#EnWpMpSearch { background: url(http://upload.wikimedia.org/wikipedia/en/a/ae/MP-magnifying-glass.png) no-repeat top right; }
#EnWpMpSearch input { vertical-align: middle; }
#EnWpMpSearchInner { float: right; width: 20em; text-align: center; }
#bodySearchMP { margin: 0; padding: 0; }
#bodySearchMP .bodySearchWrap { float: right; width: 17.5em; text-align: left; padding: .8em 0; }
#bodySearchMP label { display: block; font-size: 95%; font-weight: bold; margin-bottom: -.2em; }
#bodySearchMP .bodySearchBtnGo { font-weight: bold; padding-left: .3em; padding-right: .3em; margin-left: .5em; }
.EnWpMpContentBox { border: 1px solid; margin-bottom: .9em; }
#EnWpMpCol2 .EnWpMpContentBox { margin-left: .9em; }
.EnWpMpImage { float: right; margin: 0 0 .2em .2em; }
.EnWpMpImage img { position: relative; z-index: 3; }
#EnWpMpSisterProjects { float: left; width: 49%; }
.EnWpMpSisterProject { float: left; width: 17em; margin: 0; height: 5.5em; margin: 0; }
.EnWpMpSisterImg { float: left; width: 40px; height: 100%; }
#EnWpMpOtherLangs { margin-left: 50%; }
#EnWpMainPageNoCSS { display: none; }
#EnWpMpBook2 { background-image: url(http://upload.wikimedia.org/wikipedia/commons/8/8e/MP-open-book2.png); }
#EnWpMpSearch2 { background: url(http://upload.wikimedia.org/wikipedia/en/3/3a/MP-magnifying-glass2.png) no-repeat top right; }

/* Custom link colors for use in [[MediaWiki:Edittools]] */
.charboxblack a:link, .charboxblack a:hover, .charboxblack a:visited, .charboxblack a:active { color: black; }
.charboxsilver a:link, .charboxsilver a:hover, .charboxsilver a:visited, .charboxsilver a:active { color: silver; }
.charboxgray a:link, .charboxgray a:hover, .charboxgray a:visited, .charboxgray a:active { color: gray; }
.charboxwhite a:link, .charboxwhite a:hover, .charboxwhite a:visited, .charboxwhite a:active { color: white; }
.charboxmaroon a:link, .charboxmaroon a:hover, .charboxmaroon a:visited, .charboxmaroon a:active { color: maroon; }
.charboxred a:link, .charboxred a:hover, .charboxred a:visited, .charboxred a:active { color: red; }
.charboxpurple a:link, .charboxpurple a:hover, .charboxpurple a:visited, .charboxpurple a:active { color: purple; }
.charboxfuchsia a:link, .charboxfuchsia a:hover, .charboxfuchsia a:visited, .charboxfuchsia a:active { color: fuchsia; }

.charboxgreen a:link, .charboxgreen a:hover, .charboxgreen a:visited, .charboxgreen a:active { color: green; }
.charboxlime a:link, .charboxlime a:hover, .charboxlime a:visited, .charboxlime a:active { color: lime; }
.charboxolive a:link, .charboxolive a:hover, .charboxolive a:visited, .charboxolive a:active { color: olive; }
.charboxyellow a:link, .charboxyellow a:hover, .charboxyellow a:visited, .charboxyellow a:active { color: yellow; }

.charboxnavy a:link, .charboxnavy a:hover, .charboxnavy a:visited, .charboxnavy a:active { color: navy; }
.charboxblue a:link, .charboxblue a:hover, .charboxblue a:visited, .charboxblue a:active { color: blue; }
.charboxteal a:link, .charboxteal a:hover, .charboxteal a:visited, .charboxteal a:active { color: teal; }
.charboxaqua a:link, .charboxaqua a:hover, .charboxaqua a:visited, .charboxaqua a:active { color: aqua; }

/* custom edits */
.allpagesredirect a:link { color:#0066ff;}

 /* 维基共享资源图像巡视格式 */

  /* 链接 */
  .tickerDiffLink { } /* diff links in ticker */
  .tickerMiscLink { } /* misc links in ticker */

  /* 去除引点 */
  .tickerList ul,    .tickerList ul li    { list-style: none; text-indent:-2em; margin-left:2em;   text-align:left; }
  .tickerList ul ul, .tickerList ul ul li { list-style: none; text-indent:0;    margin-left:1.5em; text-align:left; }

  /* 各种记录格式 */
  .tickerEntry_deleted     { }  /* 图像删除记录 */
  .tickerEntry_replaced    { }  /* 图像替换记录 */
  .tickerEntry_tagged      { }  /* 加上或删去问题模板的图像记录 */
  .tickerEntry_redir       { }  /* 图像重新定向记录 */
  .tickerEntry_recat       { }  /* 图像重新分类记录 */
  .tickerEntry_notify      { }  /* 全界的更改记录 */
  .tickerEntry_changed     { }  /* 一般的更改记录 */

  /* 各种行为格式 */
  .tickerAction_deleted:before     { content:"(×)"; color: #FF0000; font-family:monospace; font-weight:bold; font-size:100%; background: pink; }
  .tickerAction_replaced:before    { content:" REPL "; color: #CC88FF; font-family:monospace; font-weight:bold; font-size:100%; }
  .tickerAction_addedBad:before    { content:" +VfD "; color: #FF8800; font-family:monospace; font-weight:bold; font-size:100%; }
  .tickerAction_removedBad:before  { content:" -VfD "; color: #00BB00; font-family:monospace; font-weight:bold; font-size:100%; }
  .tickerAction_addedGood:before   { content:" +OK  "; color: #00BB00; font-family:monospace; font-weight:bold; font-size:100%; }
  .tickerAction_removedGood:before { content:" -OK  "; color: #FF8800; font-family:monospace; font-weight:bold; font-size:100%; }

  /* 巡视功能使用列表 */
  .tickerUsage  { font-size:80%; }

  /* 每次记录应用用于多数图像的模板 */
  .tickerTemplateEntry    { font-weight: bold; }

  /* 每次记录应用次要记录---应用模板的某图像 */
  .tickerSubEntry         { }

  /* 次要记录格式 */
  .tickerMinorEntry  { color:#666; }     /* minor entry */
  .tickerMinorEntry a,
  .tickerMinorEntry a:link,
  .tickerMinorEntry a:visited { color:#669; }
  #bodyContent .tickerMinorEntry a.extiw,
  #bodyContent .tickerMinorEntry a.extiw:link,
  #bodyContent .tickerMinorEntry a.extiw:visited { color:#669; }

/* Donations link to be uncommented during fundraising drives */
#siteNotice {
    margin-top:5px;
    padding-left: 4px;
    font-style: italic;
    text-align: center;
}

/*
#fundraising {
 text-align: center;
 border: 1px solid gray;
 padding: 5px;
}
*/

/****************************/
/* BEGIN LIGHT BLUE SECTION */
/****************************/
/* Make all non-namespace pages have a light blue content area. This is done by
   setting the background color for all #content areas to light blue and then
   overriding it for any #content enclosed in a .ns-0 (main namespace). I then
   do the same for the "tab" background colors. --Lupo */

#content {
    background: #F8FCFF; /* a light blue */
}

#content div.thumb {
    border-color: #F8FCFF;
}

.ns-0 * #content {
    background: white;
}

#mytabs li {
    background: #F8FCFF;
}

.ns-0 * #mytabs li {
    background: white;
}

#mytabs li a {
    background-color: #F8FCFF;
}

.ns-0 * #mytabs li a {
    background-color: white;
}

#p-cactions li a, #p-cactions li a:hover, #p-cactions li.selected a {
    background-color: #F8FCFF;
}

.ns-0 * #p-cactions li a {
    background-color: #fbfbfb;
}

.ns-0 * #p-cactions li.selected a, .ns-0 * #p-cactions li a:hover {
    background-color: white;
}

.ns-0 * #content div.thumb {
    border-color: white;
}

/**************************/
/* END LIGHT BLUE SECTION */
/**************************/

/* Display "From Wikipedia, the free encyclopedia" */
#siteSub {
    display: inline;
    font-size: 92%;
    font-weight: normal;
}

#bodyContent #siteSub a {
    color: #000;
    text-decoration: none;
    background-color: transparent;
    background-image: none;
    padding-right: 0;
}

/* Bold 'edit this page' link to encourage newcomers */
#ca-edit a { font-weight: bold !important; }

/* Display "User $1, you are already logged in!"
   ([[MediaWiki:Alreadyloggedin]]) in red and bold */
div.alreadyloggedin { color: red; font-weight: bold; }

@media print {
    /* Do not print edit link in templates using Templat
.language-selector {
  margin-bottom: 1em;
  padding: 0.5em;
  border: 1px solid #a7d7f9;
  background-color: #f9f9f9;
  border-radius: 4px;
}

.language-selector label {
  font-weight: bold;
  margin-right: 0.5em;
}

.language-selector select {
  padding: 0.3em;
  border: 1px solid #ccd2d9;
  border-radius: 3px;
}

.language-selector span {
  display: block;
  margin-bottom: 0.3em;
  font-weight: bold;
}
#top-language-dropdown {
  position: fixed;
  top: 10px; /* 調整垂直位置 */
  left: 10px; /* 調整水平位置 */
  background-color: #f9f9f9;
  border: 1px solid #a7d7f9;
  padding: 0.5em;
  border-radius: 4px;
  z-index: 1000; /* 確保它在其他元素之上 */
}

#top-language-dropdown label {
  font-weight: bold;
  margin-right: 0.5em;
}

#top-language-dropdown select {
  padding: 0.3em;
  border: 1px solid #ccd2d9;
  border-radius: 3px;
}
#zh-variant-dropdown {
  /* 根據您的喜好設定樣式,例如 */
  margin-bottom: 1em;
  padding: 0.5em;
  border: 1px solid #a7d7f9;
  background-color: #f9f9f9;
  border-radius: 4px;
}

#zh-variant-dropdown label {
  font-weight: bold;
  margin-right: 0.5em;
}

#zh-variant-dropdown select {
  padding: 0.3em;
  border: 1px solid #ccd2d9;
  border-radius: 3px;
}

/* 如果您將其放在左上角,則需要使用 fixed 定位 */
/*
#zh-variant-dropdown {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 1000;
}
*/
/* ============================================================
 * ① 側邊欄 Logo 設定 (Q 字圖)
 * ============================================================ */
.mw-wiki-logo {
    /* 使用您指定的 Q 字圖連結 */
    background-image: url("https://upload.wikimedia.org/wikipedia/commons/b/b8/Wiki_%285%29.png") !important;
    background-size: 135px auto !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
    width: 160px !important;
    height: 160px !important;
    margin-bottom: 1em;
}

/* ============================================================
 * ② 右上角自定義元件樣式 (語系切換與時鐘)
 * ============================================================ */
/* 時鐘樣式 */
#pt-clock {
    font-family: monospace;
    background: #f8f9fa;
    border: 1px solid #c8ccd1;
    padding: 2px 8px;
    border-radius: 4px;
    color: #202122 !important;
}

/* 語系切換按鈕容器 */
#custom-variant-switches {
    background: #eaf3ff;
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid #a2c9ff;
    margin-right: 5px;
}

/* ============================================================
 * ③ 深色模式 (Dark Mode) 支援
 * 當 Common.js 切換 .dark-mode 類別時生效
 * ============================================================ */
body.dark-mode {
    background-color: #101418 !important;
    color: #e0e0e0 !important;
}

body.dark-mode #content {
    background-color: #1c2128 !important;
    color: #e0e0e0 !important;
    border-color: #444 !important;
}

body.dark-mode .mw-body {
    border-color: #30363d !important;
}

/* 深色模式下的連結顏色 */
body.dark-mode a {
    color: #58a6ff !important;
}

body.dark-mode a:visited {
    color: #bc8cff !important;
}

body.dark-mode #pt-clock {
    background: #2d333b;
    color: #adbac7 !important;
    border-color: #444;
}

/* ============================================================
 * ④ 介面優化 (選填)
 * ============================================================ */
/* 讓表格在行動端或大數據下更易讀 */
.wikitable {
    background-color: #f8f9fa;
    border: 1px solid #a2a9b1;
    border-collapse: collapse;
}

/* 隱藏沒必要的公告或標籤(可依需求取消註釋) */
/* #siteNotice { display: none; } */

/**
 * MediaWiki:Common.js 強化完整版
 * 適用對象:Quickpedia wiki
 * 功能:語系導向、手動字詞轉換、自動暫存(防 Cloudflare 斷線)、持久連線心跳包、深色模式、時鐘
 */

mw.loader.using(['mediawiki.util', 'mediawiki.Uri', 'mediawiki.api']).then(function () {

    $(function () {

        /* ============================================================
         * ① 語系自動導向與切換 (針對訪客預設 zh)
         * ============================================================ */
        var isAnon = mw.config.get('wgUserName') === null;
        var currentVariant = mw.util.getParamValue('variant') || mw.config.get('wgUserVariant');

        // 訪客預設導向中文 (zh)
        if (isAnon && !currentVariant && mw.config.get('wgAction') === 'view') {
            var url = new mw.Uri(window.location.href);
            url.query.variant = 'zh';
            window.location.replace(url.toString());
            return; 
        }

        // 建立右上角切換按鈕
        var variants = [
            { code: 'zh', label: '中文' },
            { code: 'zh-tw', label: '繁體' },
            { code: 'zh-cn', label: '简体' }
        ];

        var $langContainer = $('<span>').attr('id', 'custom-variant-switches');
        variants.forEach(function (v, i) {
            var $link = $('<a>')
                .text(v.label)
                .css({
                    cursor: 'pointer',
                    padding: '0 5px',
                    color: currentVariant === v.code ? '#000' : '#0645ad',
                    fontWeight: currentVariant === v.code ? 'bold' : 'normal'
                })
                .on('click', function (e) {
                    e.preventDefault();
                    var url = new mw.Uri(window.location.href);
                    url.query.variant = v.code;
                    window.location.href = url.toString();
                });
            $langContainer.append($link);
            if (i < variants.length - 1) $langContainer.append('|');
        });

        mw.util.addPortletLink('p-personal', '#', '', 'pt-variant-switch', '切換語系', '#pt-logout');
        $('#pt-variant-switch').append($langContainer);


        /* ============================================================
         * ② 手動字詞轉換 (確保站名正確顯示)
         * ============================================================ */
        function applyManualTranslation() {
            var v = mw.util.getParamValue('variant') || mw.config.get('wgUserVariant') || mw.config.get('wgUserLanguage');
            if (v === 'zh-hans' || v === 'zh-cn') {
                $('h1#firstHeading, #p-logo-text, .mw-wiki-title, title').each(function() {
                    var t = $(this).text();
                    // 手動將繁體站名替換為簡體
                    $(this).text(t.replace(/Quickpedia wiki/g, 'Quickpedia wiki'));
                });
            }
        }
        applyManualTranslation();


        /* ============================================================
         * ③ 自動暫存與持久編輯 (對抗 Cloudflare 驗證中斷)
         * ============================================================ */
        if (['edit', 'submit'].indexOf(mw.config.get('wgAction')) !== -1) {
            var pageName = mw.config.get('wgPageName');
            var storageKey = 'edit_cache_' + pageName;
            var $textbox = $('#wpTextbox1');

            // A. 心跳包:每 2 分鐘向伺服器發送請求,防止 Session 過期或驗證跳出
            setInterval(function() {
                new mw.Api().get({
                    action: 'query',
                    titles: pageName,
                    prop: 'info'
                }).done(function() {
                    console.log('Quickpedia wiki 連線維持中...');
                });
            }, 120000);

            // B. 高頻率自動暫存:每 20 秒存一次草稿
            setInterval(function () {
                var content = $textbox.val();
                if (content && content.length > 10) {
                    localStorage.setItem(storageKey, JSON.stringify({
                        text: content,
                        timestamp: Date.now()
                    }));
                }
            }, 20000); 

            // C. 檢查並還原草稿
            var savedCache = localStorage.getItem(storageKey);
            if (savedCache) {
                var data = JSON.parse(savedCache);
                if (Date.now() - data.timestamp < 86400000 && $textbox.val().length < 50) {
                    if (confirm('偵測到未儲存草稿(可能因 Cloudflare 驗證中斷),是否還原?')) {
                        $textbox.val(data.text);
                    }
                }
            }

            // D. 離開頁面警告
            window.onbeforeunload = function() {
                if ($textbox.val().length > 50) return "內容尚未儲存!";
            };

            // E. 儲存後清除暫存
            $('#wpSave, #wpSaveWidget, input#wpSave').on('click', function() {
                localStorage.removeItem(storageKey);
                window.onbeforeunload = null; 
            });
        }


        /* ============================================================
         * ④ 深色模式
         * ============================================================ */
        var darkBtn = mw.util.addPortletLink('p-personal', '#', '深色模式', 'pt-darkmode', '切換深色模式', '#pt-variant-switch');
        $(darkBtn).on('click', function (e) {
            e.preventDefault();
            $('body').toggleClass('dark-mode');
            localStorage.setItem('wiki-dark-mode', $('body').hasClass('dark-mode') ? '1' : '0');
        });

        if (localStorage.getItem('wiki-dark-mode') === '1') {
            $('body').addClass('dark-mode');
        }


        /* ============================================================
         * ⑤ 即時時鐘
         * ============================================================ */
        var $clock = $('<li>').attr('id', 'pt-clock').css({
            fontWeight: 'bold',
            marginLeft: '10px',
            color: '#54595d'
        });

        function updateClock() {
            var now = new Date();
            $clock.text(now.toLocaleTimeString('zh-TW', { hour12: false }));
        }

        $('#p-personal ul').append($clock);
        setInterval(updateClock, 1000);
        updateClock();

    });
});