MediaWiki: Editor.js: Unterschied zwischen den Versionen

Aus Joachim Camerarius (1500-1574)
Wechseln zu: Navigation, Suche
(Inital Commit)
 
Keine Bearbeitungszusammenfassung
Zeile 1: Zeile 1:
//Camerarius Wikieditor Customization
let customizeToolbar = function () {
//Check if Page gets edited
$('#wpTextbox1').wikiEditor('addToToolbar', {
if ( [ 'edit', 'submit' ].indexOf( mw.config.get( 'wgAction' ) ) !== -1 ) {
    //Create new toolbar section Camerarius which is itself a toolbar               
// Add a hook handler.
    sections: {
mw.hook( 'wikiEditor.toolbarReady' ).add( function ( $textarea ) {
        camerarius: {
            $textarea.wikiEditor( 'addToToolbar', {
            type: 'toolbar',
//Create new toolbar section Camerarius which is itself a toolbar               
            label: 'Camerarius-Attribute',
                sections:{
            //Create dropdown part of the toolbar
                    camerarius:{
            'groups': {
                        type: 'toolbar',
                'format': {
                        label: 'Camerarius-Attribute',
                    'tools': {
//Create dropdown part of the toolbar
                        'Attribute': {
                        'groups': {
                            'label': 'Attribute-Allgemein',
'format': {
                            'type': 'select',
'tools': {
                            'list': {
'Attribute': {
                                'Auftraggeber': {
'label': 'Attribute-Allgemein',
                                    'label': 'Auftraggeber',
'type': 'select',
                                    'action': {
'list': {
                                        'type': 'encapsulate',
'Auftraggeber' : {
                                        'options': {
'label': 'Auftraggeber',
                                            'pre': '[[Auftraggeber::',
'action': {
                                            'periMsg': 'Auftragsgeber',
'type': 'encapsulate',
                                            'post': ']]'
'options': {
                                        }
'pre': '[[Auftraggeber::',
                                    }
'periMsg': 'Auftragsgeber',
                                },
'post': ']]'
                                'Beeinflusser': {
}
                                    'label': 'Beeinflusser',
}
                                    'action': {
},
                                        'type': 'encapsulate',
'Beeinflusser' : {
                                        'options': {
'label': 'Beeinflusser',
                                            'pre': '[[Beeinflusser::',
'action': {
                                            'periMsg': 'Beeinflusser',
'type': 'encapsulate',
                                            'post': ']]'
'options': {
                                        }
'pre': '[[Beeinflusser::',
                                    }
'periMsg': 'Beeinflusser',
                                },
'post': ']]'
                                'Briefpartner': {
}
                                    'label': 'Briefpartner',
}
                                    'action': {
},
                                        'type': 'encapsulate',
'Briefpartner' : {
                                        'options': {
'label': 'Briefpartner',
                                            'pre': '[[Briefpartner::',
'action': {
                                            'periMsg': 'Briefpartner',
'type': 'encapsulate',
                                            'post': ']]'
'options': {
                                        }
'pre': '[[Briefpartner::',
                                    }
'periMsg': 'Briefpartner',
                                },
'post': ']]'
                                'Erwähnte Körperschaft': {
}
                                    'label': 'Erwähnte Körperschaft',
}
                                    'action': {
},
                                        'type': 'encapsulate',
'Erwähnte Körperschaft' : {
                                        'options': {
'label': 'Erwähnte Körperschaft',
                                            'pre': '[[Erwähnte Körperschaft::',
'action': {
                                            'periMsg': 'Körperschaft',
'type': 'encapsulate',
                                            'post': ']]'
'options': {
                                        }
'pre': '[[Erwähnte Körperschaft::',
                                    }
'periMsg': 'Körperschaft',
                                },
'post': ']]'
                                'Erwähnte Person': {
}
                                    'label': 'Erwähnte Person',
}
                                    'action': {
},
                                        'type': 'encapsulate',
'Erwähnte Person' : {
                                        'options': {
'label': 'Erwähnte Person',
                                            'pre': '[[Erwähnte Person::',
'action': {
                                            'periMsg': 'Adressat',
'type': 'encapsulate',
                                            'post': ']]'
'options': {
                                        }
'pre': '[[Erwähnte Person::',
                                    }
'periMsg': 'Adressat',
                                },
'post': ']]'
                                'Erwähnter Ort': {
}
                                    'label': 'Erwähnter Ort',
}
                                    'action': {
},
                                        'type': 'encapsulate',
'Erwähnter Ort' : {
                                        'options': {
'label': 'Erwähnter Ort',
                                            'pre': '[[Erwähnter Ort::',
'action': {
                                            'periMsg': 'Ort',
'type': 'encapsulate',
                                            'post': ']]'
'options': {
                                        }
'pre': '[[Erwähnter Ort::',
                                    }
'periMsg': 'Ort',
                                },
'post': ']]'
                                'Erwähntes Werk': {
}
                                    'label': 'Erwähntes Werk',
}
                                    'action': {
},
                                        'type': 'encapsulate',
'Erwähntes Werk' : {
                                        'options': {
'label': 'Erwähntes Werk',
                                            'pre': '[[Erwähntes Werk::',
'action': {
                                            'periMsg': 'Erwähntes Werkt',
'type': 'encapsulate',
                                            'post': ']]'
'options': {
                                        }
'pre': '[[Erwähntes Werk::',
                                    }
'periMsg': 'Erwähntes Werkt',
                                },
'post': ']]'
                                'Forschungsliteratur': {
}
                                    'label': 'Forschungsliteratur',
}
                                    'action': {
},
                                        'type': 'encapsulate',
'Forschungsliteratur' : {
                                        'options': {
'label': 'Forschungsliteratur',
                                            'pre': '[[Forschungsliteratur::',
'action': {
                                            'periMsg': 'Forschungsliteratur',
'type': 'encapsulate',
                                            'post': ']]'
'options': {
                                        }
'pre': '[[Forschungsliteratur::',
                                    }
'periMsg': 'Forschungsliteratur',
                                },
'post': ']]'
                                'Gesprächspartner': {
}
                                    'label': 'Gesprächspartner',
}
                                    'action': {
},
                                        'type': 'encapsulate',
'Gesprächspartner' : {
                                        'options': {
'label': 'Gesprächspartner',
                                            'pre': '[[Gesprächspartner::',
'action': {
                                            'periMsg': 'Gesprächspartner',
'type': 'encapsulate',
                                            'post': ']]'
'options': {
                                        }
'pre': '[[Gesprächspartner::',
                                    }
'periMsg': 'Gesprächspartner',
                                },
'post': ']]'
                                'Initiator': {
}
                                    'label': 'Initiator',
}
                                    'action': {
},
                                        'type': 'encapsulate',
'Initiator' : {
                                        'options': {
'label': 'Initiator',
                                            'pre': '[[Initiator::',
'action': {
                                            'periMsg': 'Initiator',
'type': 'encapsulate',
                                            'post': ']]'
'options': {
                                        }
'pre': '[[Initiator::',
                                    }
'periMsg': 'Initiator',
                                },
'post': ']]'
                                'Lehrer': {
}
                                    'label': 'Lehrer',
}
                                    'action': {
},
                                        'type': 'encapsulate',
'Lehrer' : {
                                        'options': {
'label': 'Lehrer',
                                            'pre': '[[Lehrer::',
'action': {
                                            'periMsg': 'Lehrer',
'type': 'encapsulate',
                                            'post': ']]'
'options': {
                                        }
'pre': '[[Lehrer::',
                                    }
'periMsg': 'Lehrer',
                                },
'post': ']]'
                                'Schüler': {
}
                                    'label': 'Schüler',
}
                                    'action': {
},
                                        'type': 'encapsulate',
'Schüler' : {
                                        'options': {
'label': 'Schüler',
                                            'pre': '[[Schüler::',
'action': {
                                            'periMsg': 'Schüler',
'type': 'encapsulate',
                                            'post': ']]'
'options': {
                                        }
'pre': '[[Schüler::',
                                    }
'periMsg': 'Schüler',
                                },
'post': ']]'
                                'Student': {
}
                                    'label': 'Student',
}
                                    'action': {
},
                                        'type': 'encapsulate',
'Student' : {
                                        'options': {
'label': 'Student',
                                            'pre': '[[Student::',
'action': {
                                            'periMsg': 'Student',
'type': 'encapsulate',
                                            'post': ']]'
'options': {
                                        }
'pre': '[[Student::',
                                    }
'periMsg': 'Student',
                                },
'post': ']]'
                                'Unterstützer': {
}
                                    'label': 'Unterstützer',
}
                                    'action': {
},
                                        'type': 'encapsulate',
'Unterstützer' : {
                                        'options': {
'label': 'Unterstützer',
                                            'pre': '[[Unterstützer::',
'action': {
                                            'periMsg': 'Unterstützer',
'type': 'encapsulate',
                                            'post': ']]'
'options': {
                                        }
'pre': '[[Unterstützer::',
                                    }
'periMsg': 'Unterstützer',
                                },
'post': ']]'
                                'Werkadressat': {
}
                                    'label': 'Werkadressat',
}
                                    'action': {
},
                                        'type': 'encapsulate',
'Werkadressat' : {
                                        'options': {
'label': 'Werkadressat',
                                            'pre': '[[Werkadressat::',
'action': {
                                            'periMsg': 'Adressat',
'type': 'encapsulate',
                                            'post': ']]'
'options': {
                                        }
'pre': '[[Werkadressat::',
                                    }
'periMsg': 'Adressat',
                                },
'post': ']]'
                                'Widmender': {
}
                                    'label': 'Widmender',
}
                                    'action': {
},
                                        'type': 'encapsulate',
'Widmender' : {
                                        'options': {
'label': 'Widmender',
                                            'pre': '[[Widmender::',
'action': {
                                            'periMsg': 'Widmender',
'type': 'encapsulate',
                                            'post': ']]'
'options': {
                                        }
'pre': '[[Widmender::',
                                    }
'periMsg': 'Widmender',
                                },
'post': ']]'
                                'Widmungsempfänger': {
}
                                    'label': 'Widmungsempfänger',
}
                                    'action': {
},
                                        'type': 'encapsulate',
'Widmungsempfänger' : {
                                        'options': {
'label': 'Widmungsempfänger',
                                            'pre': '[[Widmungsempfänger::',
'action': {
                                            'periMsg': 'Widmungsempfänger',
'type': 'encapsulate',
                                            'post': ']]'
'options': {
                                        }
'pre': '[[Widmungsempfänger::',
                                    }
'periMsg': 'Widmungsempfänger',
                                },
'post': ']]'
                                'Nachrufempfänger': {
}
                                    'label': 'Nachrufempfänger',
}
                                    'action': {
},
                                        'type': 'encapsulate',
'Nachrufempfänger' : {
                                        'options': {
'label': 'Nachrufempfänger',
                                            'pre': '[[Nachruf auf::',
'action': {
                                            'periMsg': 'Nachruf auf',
'type': 'encapsulate',
                                            'post': ']]'
'options': {
                                        }
'pre': '[[Nachruf auf::',
                                    }
'periMsg': 'Nachruf auf',
                                },
'post': ']]'
                            }
}
                        },
}
                        //Create the button parts
},
                        'Beschreibungen': {
}
                            'label': 'Beschreibungen',
},
                            'type': 'button',
//----------------
                            'icon': {
// 'AttributePersonen': {
                                'default': 'format-bold-B.png',
// 'labelMsg': 'wikieditor-toolbar-tool-camerarius-properties-person',
                                'en': 'format-bold-B.png',
// 'type': 'select',
                                'de': 'format-bold-B.png'
// 'list': {
                            },
// 'Beruf' : {
                            'action': {
// 'labelMsg': 'wikieditor-toolbar-tool-camerarius-job',
                                'type': 'encapsulate',
// 'action': {
                                'options': {
// 'type': 'encapsulate',
                                    'pre': "{{Beschreibungen|",
// 'options': {
                                    'periMsg': 'Seitenname',
// 'pre': '[[Beruf::',
                                    'post': "}}"
// 'periMsg': 'Beruf',
                                }
// 'post': ']]'
                            }
// }
                        },
// }
                        'MBW': {
// },
                            'label': 'MBW',
// 'Studienort' : {
                            'type': 'button',
// 'labelMsg': 'wikieditor-toolbar-tool-camerarius-studyplace',
                            'icon': {
// 'action': {
                                'default': 'Toolbaricon_bold_M.png',
// 'type': 'encapsulate',
                                'en': 'Toolbaricon_bold_M.png',
// 'options': {
                                'de': 'Toolbaricon_bold_M.png'
// 'pre': '[[Studienort::',
                            },
// 'periMsg': 'Studienort',
                            'action': {
// 'post': ']]'
                                'type': 'encapsulate',
// }
                                'options': {
// }
                                    'pre': "[http://www.haw.uni-heidelberg.de/forschung/forschungsstellen/melanchthon/mbw-online.de.html MBW], Nr. ",
// },
                                    'periMsg': 'Nr.'
// }
                                }
// },
                            }
//----------------
                        },
//Create the button parts
                        'Link': {
'Beschreibungen': {
                            'label': 'Verlinkung',
'label': 'Beschreibungen',
                            'type': 'button',
'type': 'button',
                            'icon': {
'icon': {
                                'default': 'insert-ilink.png',
'default': 'format-bold-B.png',
                                'en': 'insert-ilink.png',
'en': 'format-bold-B.png',
                                'de': 'insert-ilink.png'
'de': 'format-bold-B.png'
                            },
},
                            'action': {
'action': {
                                'type': 'encapsulate',
'type': 'encapsulate',
                                'options': {
'options': {
                                    'pre': "[[",
'pre': "{{Beschreibungen|",
                                    'periMsg': 'Text',
'periMsg': 'Seitenname',
                                    'post': "]]"
'post': "}}"
                                }
}
                            }
}
                        },
},
'MBW': {
'label': 'MBW',
'type': 'button',
'icon': {
'default': 'Toolbaricon_bold_M.png',
'en': 'Toolbaricon_bold_M.png',
'de': 'Toolbaricon_bold_M.png'
},
'action': {
'type': 'encapsulate',
'options': {
'pre': "[http://www.haw.uni-heidelberg.de/forschung/forschungsstellen/melanchthon/mbw-online.de.html MBW], Nr. ",
'periMsg': 'Nr.'
}
}
},
'Link': {
'label': 'Verlinkung',
'type': 'button',
'icon': {
'default': 'insert-ilink.png',
'en': 'insert-ilink.png',
'de': 'insert-ilink.png'
},
'action': {
'type': 'encapsulate',
'options': {
'pre': "[[",
'periMsg': 'Text',
'post': "]]"
}
}
},
/*'varianz': {
'label': 'Varianz',
'type': 'button',
'icon': {
'default': 'Toolbaricon_bold_V.png',
'en': 'Toolbaricon_bold_V.png',
'de': 'Toolbaricon_bold_V.png'
},
'action': {
'type': 'encapsulate',
'options': {
'pre': "[[Varianz::Varianz:",
'periMsg': 'KÜRZEL-NUMMER',
'post': "|↗]]"
}
}
},
'notiz': {
'label': 'notiz',
'type': 'button',
'icon': {
'default': 'Toolbaricon_bold_N.png',
'en': 'Toolbaricon_bold_N.png',
'de': 'Toolbaricon_bold_N.png'
},
'action': {
'type': 'encapsulate',
'options': {
'pre': "[[Notiz::Notiz:",
'periMsg': 'LINK-ERGÄNZEN',
'post': "|⤇]]"
}
}
},
'marginale': {
'id': 'marginale',
'label': 'marginale',
'type': 'button',
'icon': {
'default': 'Toolbaricon_bold_M.png',
'en': 'Toolbaricon_bold_M.png',
'de': 'Toolbaricon_bold_M.png'
},
'action': {
'type': 'marginale',
'options': {
//'pre': "[[Elemente::"+myPagename+"/Marginale|",
'pre': "[[Elemente::Marginale",
'periMsg': 'Marginale',
'post': "]]"
}
}
},*/
}
}
}
                     }
                     }
                 }
                 }
             } );
             }
        } );
        }
    }
});
};
 
/* 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' ).then( function () {
// This can be the string "0" if the user disabled the preference ([[phab:T54542#555387]])
if ( mw.user.options.get( 'usebetatoolbar' ) == 1 ) {
$.when(
mw.loader.using( 'ext.wikiEditor.toolbar' ), $.ready
).then( customizeToolbar );
}
} );
}
}
//Camerarius Wikieditor Customization End

Version vom 17. August 2022, 13:40 Uhr

let customizeToolbar = function () {
$('#wpTextbox1').wikiEditor('addToToolbar', {
    //Create new toolbar section Camerarius which is itself a toolbar               
    sections: {
        camerarius: {
            type: 'toolbar',
            label: 'Camerarius-Attribute',
            //Create dropdown part of the toolbar
            'groups': {
                'format': {
                    'tools': {
                        'Attribute': {
                            'label': 'Attribute-Allgemein',
                            'type': 'select',
                            'list': {
                                'Auftraggeber': {
                                    'label': 'Auftraggeber',
                                    'action': {
                                        'type': 'encapsulate',
                                        'options': {
                                            'pre': '[[Auftraggeber::',
                                            'periMsg': 'Auftragsgeber',
                                            'post': ']]'
                                        }
                                    }
                                },
                                'Beeinflusser': {
                                    'label': 'Beeinflusser',
                                    'action': {
                                        'type': 'encapsulate',
                                        'options': {
                                            'pre': '[[Beeinflusser::',
                                            'periMsg': 'Beeinflusser',
                                            'post': ']]'
                                        }
                                    }
                                },
                                'Briefpartner': {
                                    'label': 'Briefpartner',
                                    'action': {
                                        'type': 'encapsulate',
                                        'options': {
                                            'pre': '[[Briefpartner::',
                                            'periMsg': 'Briefpartner',
                                            'post': ']]'
                                        }
                                    }
                                },
                                'Erwähnte Körperschaft': {
                                    'label': 'Erwähnte Körperschaft',
                                    'action': {
                                        'type': 'encapsulate',
                                        'options': {
                                            'pre': '[[Erwähnte Körperschaft::',
                                            'periMsg': 'Körperschaft',
                                            'post': ']]'
                                        }
                                    }
                                },
                                'Erwähnte Person': {
                                    'label': 'Erwähnte Person',
                                    'action': {
                                        'type': 'encapsulate',
                                        'options': {
                                            'pre': '[[Erwähnte Person::',
                                            'periMsg': 'Adressat',
                                            'post': ']]'
                                        }
                                    }
                                },
                                'Erwähnter Ort': {
                                    'label': 'Erwähnter Ort',
                                    'action': {
                                        'type': 'encapsulate',
                                        'options': {
                                            'pre': '[[Erwähnter Ort::',
                                            'periMsg': 'Ort',
                                            'post': ']]'
                                        }
                                    }
                                },
                                'Erwähntes Werk': {
                                    'label': 'Erwähntes Werk',
                                    'action': {
                                        'type': 'encapsulate',
                                        'options': {
                                            'pre': '[[Erwähntes Werk::',
                                            'periMsg': 'Erwähntes Werkt',
                                            'post': ']]'
                                        }
                                    }
                                },
                                'Forschungsliteratur': {
                                    'label': 'Forschungsliteratur',
                                    'action': {
                                        'type': 'encapsulate',
                                        'options': {
                                            'pre': '[[Forschungsliteratur::',
                                            'periMsg': 'Forschungsliteratur',
                                            'post': ']]'
                                        }
                                    }
                                },
                                'Gesprächspartner': {
                                    'label': 'Gesprächspartner',
                                    'action': {
                                        'type': 'encapsulate',
                                        'options': {
                                            'pre': '[[Gesprächspartner::',
                                            'periMsg': 'Gesprächspartner',
                                            'post': ']]'
                                        }
                                    }
                                },
                                'Initiator': {
                                    'label': 'Initiator',
                                    'action': {
                                        'type': 'encapsulate',
                                        'options': {
                                            'pre': '[[Initiator::',
                                            'periMsg': 'Initiator',
                                            'post': ']]'
                                        }
                                    }
                                },
                                'Lehrer': {
                                    'label': 'Lehrer',
                                    'action': {
                                        'type': 'encapsulate',
                                        'options': {
                                            'pre': '[[Lehrer::',
                                            'periMsg': 'Lehrer',
                                            'post': ']]'
                                        }
                                    }
                                },
                                'Schüler': {
                                    'label': 'Schüler',
                                    'action': {
                                        'type': 'encapsulate',
                                        'options': {
                                            'pre': '[[Schüler::',
                                            'periMsg': 'Schüler',
                                            'post': ']]'
                                        }
                                    }
                                },
                                'Student': {
                                    'label': 'Student',
                                    'action': {
                                        'type': 'encapsulate',
                                        'options': {
                                            'pre': '[[Student::',
                                            'periMsg': 'Student',
                                            'post': ']]'
                                        }
                                    }
                                },
                                'Unterstützer': {
                                    'label': 'Unterstützer',
                                    'action': {
                                        'type': 'encapsulate',
                                        'options': {
                                            'pre': '[[Unterstützer::',
                                            'periMsg': 'Unterstützer',
                                            'post': ']]'
                                        }
                                    }
                                },
                                'Werkadressat': {
                                    'label': 'Werkadressat',
                                    'action': {
                                        'type': 'encapsulate',
                                        'options': {
                                            'pre': '[[Werkadressat::',
                                            'periMsg': 'Adressat',
                                            'post': ']]'
                                        }
                                    }
                                },
                                'Widmender': {
                                    'label': 'Widmender',
                                    'action': {
                                        'type': 'encapsulate',
                                        'options': {
                                            'pre': '[[Widmender::',
                                            'periMsg': 'Widmender',
                                            'post': ']]'
                                        }
                                    }
                                },
                                'Widmungsempfänger': {
                                    'label': 'Widmungsempfänger',
                                    'action': {
                                        'type': 'encapsulate',
                                        'options': {
                                            'pre': '[[Widmungsempfänger::',
                                            'periMsg': 'Widmungsempfänger',
                                            'post': ']]'
                                        }
                                    }
                                },
                                'Nachrufempfänger': {
                                    'label': 'Nachrufempfänger',
                                    'action': {
                                        'type': 'encapsulate',
                                        'options': {
                                            'pre': '[[Nachruf auf::',
                                            'periMsg': 'Nachruf auf',
                                            'post': ']]'
                                        }
                                    }
                                },
                            }
                        },
                        //Create the button parts
                        'Beschreibungen': {
                            'label': 'Beschreibungen',
                            'type': 'button',
                            'icon': {
                                'default': 'format-bold-B.png',
                                'en': 'format-bold-B.png',
                                'de': 'format-bold-B.png'
                            },
                            'action': {
                                'type': 'encapsulate',
                                'options': {
                                    'pre': "{{Beschreibungen|",
                                    'periMsg': 'Seitenname',
                                    'post': "}}"
                                }
                            }
                        },
                        'MBW': {
                            'label': 'MBW',
                            'type': 'button',
                            'icon': {
                                'default': 'Toolbaricon_bold_M.png',
                                'en': 'Toolbaricon_bold_M.png',
                                'de': 'Toolbaricon_bold_M.png'
                            },
                            'action': {
                                'type': 'encapsulate',
                                'options': {
                                    'pre': "[http://www.haw.uni-heidelberg.de/forschung/forschungsstellen/melanchthon/mbw-online.de.html MBW], Nr. ",
                                    'periMsg': 'Nr.'
                                }
                            }
                        },
                        'Link': {
                            'label': 'Verlinkung',
                            'type': 'button',
                            'icon': {
                                'default': 'insert-ilink.png',
                                'en': 'insert-ilink.png',
                                'de': 'insert-ilink.png'
                            },
                            'action': {
                                'type': 'encapsulate',
                                'options': {
                                    'pre': "[[",
                                    'periMsg': 'Text',
                                    'post': "]]"
                                }
                            }
                        },
                    }
                }
            }
        }
    }
});
};

/* 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' ).then( function () {
		// This can be the string "0" if the user disabled the preference ([[phab:T54542#555387]])
		if ( mw.user.options.get( 'usebetatoolbar' ) == 1 ) {
			$.when(
				mw.loader.using( 'ext.wikiEditor.toolbar' ), $.ready
			).then( customizeToolbar );
		}
	} );
}