Difference between revisions of "MediaWiki:Common.js"

From SacredWiki
Jump to navigation Jump to search
m
 
(39 intermediate revisions by the same user not shown)
Line 45: Line 45:
 
     "tagClose": "}}",
 
     "tagClose": "}}",
 
     "sampleText": ""};
 
     "sampleText": ""};
  mwCustomEditButtons[mwCustomEditButtons.length] = {
+
  }
    "imageFile": "http://www.darkmatters.org/SacredWiki/images/buttons/npc.jpg",
 
    "speedTip": "NPC Template.",
 
    "tagOpen": "__NOTOC__
 
{{Languages}}
 
{{S2frame|[[Image:UPLOAD A PORTRAIT IMAGE TO THE WIKI AND PUT IMAGE NAME HERE|{550}x{200}px]]|right}}
 
 
 
 
 
 
 
WRITE HERE A GENERAL DESCRIPTION ON WHO IS THIS NPC, WHERE HE IS, WHICH QUESTS DOES HE TAKE PART IN, ETC.  BE CREATIVE.
 
 
 
 
 
==== Location ====
 
* {{PAGENAME}} can be located in [[Sacred 2:REPLACE WITH PAGE NAME OF PLACE|REPLACE WITH PAGE NAME OF PLACE]]
 
* [[Sacred 2:Map of Ancaria|Have a look through the SacredWiki Map]]
 
UPLOAD TWO IMAGES SHOWING THE LOCATION.  A TAB MAP IMAGE AND AN "M" MAP IMAGE.
 
{{S2frame|[[Image:NAME OF IMAGE|300px]] [[Image:NAME OF IMAGE|300px]]|left}}
 
<br clear="left" />
 
  
 
+
var customizeToolbar = function() {
==== Quests ====
+
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
REMOVE FROM THE FOLLOWING LINES THOSE WHICH DON'T MATCH OR DON'T APPLY TO THE NPC YOU ARE ADDING. REMOVE THIS TEXT AS WELL.
+
        'section': 'main',
* {{PAGENAME}} is quest giver for [[Sacred 2:REPLACE WITH A LINK TO THE CORRECT QUEST|REPLACE WITH A LINK TO THE CORRECT QUEST]] quest
+
        'group': 'insert',
* {{PAGENAME}} is involved in [[Sacred 2:REPLACE WITH A LINK TO THE CORRECT QUEST|REPLACE WITH A LINK TO THE CORRECT QUEST]] quest
+
        'tools': {
 
+
                'S1link': {
==== Notes ====
+
                        label: 'Sacred 1 Link', // or use labelMsg for a localized label, see above
* ADD NOTES HERE (IF APPROPIATE) IN LIST LAYOUT
+
                        type: 'button',
* LIST LAYOUT HELPS TO MAKE THIS MORE READABLE
+
                        icon: 'S1link.jpg',
 
+
'action': {
[[Category:Sacred 2 NPC]]
+
'type': 'encapsulate',
",
+
'options': {
    "tagClose": "",
+
'pre': "[[Sacred:",
    "sampleText": ""};
+
'peri': 'Page Name you want to link to',
  }
+
'post': "|]]"
 +
}
 +
}
 +
          },
 +
                'S2link': {
 +
                        label: 'Sacred 2 Link', // or use labelMsg for a localized label, see above
 +
                        type: 'button',
 +
                        icon: 'S2link.jpg',
 +
'action': {
 +
'type': 'encapsulate',
 +
'options': {
 +
'pre': "[[Sacred 2:",
 +
'peri': 'Page Name you want to link to',
 +
'post': "|]]"
 +
}
 +
}
 +
},
 +
                'Quest': {
 +
                        label: 'Quest Template.  Push the preview to see results', // or use labelMsg for a localized label, see above
 +
                        type: 'button',
 +
                        icon: 'quest.png',
 +
'action': {
 +
'type': 'encapsulate',
 +
'options': {
 +
'pre': "{{subst:Quest",
 +
'post': "}}"
 +
}
 +
}
 +
},
 +
                'ChainQuest': {
 +
                        label: 'Chain Quest Template.  Push the preview to see results', // or use labelMsg for a localized label, see above
 +
                        type: 'button',
 +
                        icon: 'chainquest.png',
 +
'action': {
 +
'type': 'encapsulate',
 +
'options': {
 +
'pre': "{{subst:ChainQuest",
 +
'post': "}}"
 +
}
 +
}
 +
},
 +
                'Place': {
 +
                        label: 'Place Template.  Push the preview to see results', // or use labelMsg for a localized label, see above
 +
                        type: 'button',
 +
                        icon: 'place.png',
 +
'action': {
 +
'type': 'encapsulate',
 +
'options': {
 +
'pre': "{{subst:Place",
 +
'post': "}}"
 +
}
 +
}
 +
},
 +
                'NPC': {
 +
                        label: 'NPC Template.  Push the preview to see results', // or use labelMsg for a localized label, see above
 +
                        type: 'button',
 +
                        icon: 'NPC.png',
 +
'action': {
 +
'type': 'encapsulate',
 +
'options': {
 +
'pre': "{{subst:NPC",
 +
'post': "}}"
 +
}
 +
}
 +
},
 +
/*               'TEST': {
 +
                        label: 'TESTing',
 +
                        type: 'button',
 +
                        icon: 'NPC.png',
 +
'action': {
 +
                            'type':'dialog',
 +
                                'module':'insert-link'
 +
}
 +
}
 +
}, */
 +
                'S2Frame': {
 +
                        label: 'Sacred 2 Frame to put around images and videos',
 +
                        type: 'button',
 +
                        icon: 's2frame.png',
 +
'action': {
 +
'type': 'encapsulate',
 +
'options': {
 +
'pre': "{{s2frame|",
 +
'post': "|none}}"
 +
}
 +
}
 +
},
 +
                'Dialogue': {
 +
                        label: 'S2 Dialogue Template.  Push the preview to see results', // or use labelMsg for a localized label, see above
 +
                        type: 'button',
 +
                        icon: 'dialogue.png',
 +
'action': {
 +
'type': 'encapsulate',
 +
'options': {
 +
'pre': "{{S2 Dialogue|NPC NAME=NPCNAME|PORTRAIT FILE NAME=NoPicDialog.png|DIALOGUE=<poem>",
 +
'peri': 'TYPEtextHERE',
 +
'post': "</poem>}}"
 +
}
 +
}
 +
}
 +
        }
 +
} );
 +
}
 +
 +
/* Check if view is in edit mode and that the required modules are available. Then, customize the toolbar . . . */
 +
if ( $.inArray( mw.config.get( 'wgAction' ), ['edit', 'submit'] ) !== -1 ) {
 +
        mw.loader.using( 'user.options', function () {
 +
                if ( mw.user.options.get('usebetatoolbar') ) {
 +
                        mw.loader.using( 'ext.wikiEditor.toolbar', function () {
 +
                                $(document).ready( customizeToolbar );
 +
                        } );
 +
                }
 +
        } );
 +
}

Latest revision as of 10:36, 25 February 2014

/* Any JavaScript here will be loaded for all users on every page load. */


 if (mwCustomEditButtons) {
   mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://www.darkmatters.org/SacredWiki/images/buttons/align_center.png",
     "speedTip": "Will center highlighted text.",
     "tagOpen": "<center>",
     "tagClose": "</center>",
     "sampleText": ""};
   mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://www.darkmatters.org/SacredWiki/images/buttons/S1internallink.jpg",
     "speedTip": "Make a Sacred Underworld Internal Link",
     "tagOpen": "[[Sacred:",
     "tagClose": "|]]",
     "sampleText": "Page Name you are linking to"};
   mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://www.darkmatters.org/SacredWiki/images/buttons/S2internallink.jpg",
     "speedTip": "Make a Sacred 2:Fallen Angel Internal Link",
     "tagOpen": "[[Sacred 2:",
     "tagClose": "|]]",
     "sampleText": "Type here what you want the link to be read as..."};
   mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://www.darkmatters.org/SacredWiki/images/buttons/questbutton.jpg",
     "speedTip": "Quest Template.  Push the preview to see results.",
     "tagOpen": "{{subst:Quest",
     "tagClose": "}}",
     "sampleText": ""};
   mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://www.darkmatters.org/SacredWiki/images/buttons/chainquest.jpg",
     "speedTip": "ChainQuest Template.  Push the preview to see results.",
     "tagOpen": "{{subst:ChainQuest",
     "tagClose": "}}",
     "sampleText": ""};
   mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://www.darkmatters.org/SacredWiki/images/buttons/place.jpg",
     "speedTip": "Place Template.  Push the preview to see results.",
     "tagOpen": "{{subst:Place",
     "tagClose": "}}",
     "sampleText": ""};
   mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://www.darkmatters.org/SacredWiki/images/buttons/npc.jpg",
     "speedTip": "NPC Template.  Push the preview to see results.",
     "tagOpen": "{{subst:NPC",
     "tagClose": "}}",
     "sampleText": ""};
  }

var customizeToolbar = function() {
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        'section': 'main',
        'group': 'insert',
        'tools': {
                'S1link': {
                        label: 'Sacred 1 Link', // or use labelMsg for a localized label, see above
                        type: 'button',
                        icon: 'S1link.jpg',
			'action': {
				'type': 'encapsulate',
				'options': {
					'pre': "[[Sacred:",
					'peri': 'Page Name you want to link to',
					'post': "|]]"
				}
			}
          },
                'S2link': {
                        label: 'Sacred 2 Link', // or use labelMsg for a localized label, see above
                        type: 'button',
                        icon: 'S2link.jpg',
			'action': {
				'type': 'encapsulate',
				'options': {
					'pre': "[[Sacred 2:",
					'peri': 'Page Name you want to link to',
					'post': "|]]"
					}
				}
			},
                'Quest': {
                        label: 'Quest Template.  Push the preview to see results', // or use labelMsg for a localized label, see above
                        type: 'button',
                        icon: 'quest.png',
			'action': {
				'type': 'encapsulate',
				'options': {
					'pre': "{{subst:Quest",
					'post': "}}"
					}
				}
			},
                'ChainQuest': {
                        label: 'Chain Quest Template.  Push the preview to see results', // or use labelMsg for a localized label, see above
                        type: 'button',
                        icon: 'chainquest.png',
			'action': {
				'type': 'encapsulate',
				'options': {
					'pre': "{{subst:ChainQuest",
					'post': "}}"
					}
				}
			},
                'Place': {
                        label: 'Place Template.  Push the preview to see results', // or use labelMsg for a localized label, see above
                        type: 'button',
                        icon: 'place.png',
			'action': {
				'type': 'encapsulate',
				'options': {
					'pre': "{{subst:Place",
					'post': "}}"
					}
				}
			},
                'NPC': {
                        label: 'NPC Template.  Push the preview to see results', // or use labelMsg for a localized label, see above
                        type: 'button',
                        icon: 'NPC.png',
			'action': {
				'type': 'encapsulate',
				'options': {
					'pre': "{{subst:NPC",
					'post': "}}"
					}
				}
			},
/*                'TEST': {
                        label: 'TESTing',
                        type: 'button',
                        icon: 'NPC.png',
			'action': {
                            'type':'dialog',
                                'module':'insert-link'
					}
				}
			}, */
                'S2Frame': {
                        label: 'Sacred 2 Frame to put around images and videos',
                        type: 'button',
                        icon: 's2frame.png',
			'action': {
				'type': 'encapsulate',
				'options': {
					'pre': "{{s2frame|",
					'post': "|none}}"
					}
				}
			},
                'Dialogue': {
                        label: 'S2 Dialogue Template.  Push the preview to see results', // or use labelMsg for a localized label, see above
                        type: 'button',
                        icon: 'dialogue.png',
			'action': {
				'type': 'encapsulate',
				'options': {
					'pre': "{{S2 Dialogue|NPC NAME=NPCNAME|PORTRAIT FILE NAME=NoPicDialog.png|DIALOGUE=<poem>",
					'peri': 'TYPEtextHERE',
					'post': "</poem>}}"
					}
				}
			}
        }
} );
}
 
/* Check if view is in edit mode and that the required modules are available. Then, customize the toolbar . . . */
if ( $.inArray( mw.config.get( 'wgAction' ), ['edit', 'submit'] ) !== -1 ) {
        mw.loader.using( 'user.options', function () {
                if ( mw.user.options.get('usebetatoolbar') ) {
                        mw.loader.using( 'ext.wikiEditor.toolbar', function () {
                                $(document).ready( customizeToolbar );
                        } );
                }
        } );
}