Χρήστης:ManosHacker/πρόχειρο/myspecialchars.js

Από τη Βικιπαίδεια, την ελεύθερη εγκυκλοπαίδεια

Μετά την αποθήκευση πρέπει να καθαρίσετε την κρυφή μνήμη (cache) του browser σας για να δείτε τις αλλαγές: Σε Chrome, Firefox, Safari, Internet Explorer και Edge: Κρατήστε πατημένο το Shift και κάντε κλικ στο κουμπί Ανανέωση στην μπάρα εργαλείων.

mw.hook('ve.activationComplete').add(function(){
  var mychars = {"Αεροπλάνα και βαπόρια":{
                    "✈":"✈",
 {
   "</>": {
     "string": "</>",
     "source": true
   }
 },
    "«»": {
        "action": {
            "type": "encapsulate",
            "options": {
                "pre": "«",
                "post": "»"
            }
        }
    },
                    '🚢':'🚢'
                  }
  };
  var surface = ve.init.target.surface;

  function dialogopen(win, opening){
    if(win instanceof ve.ui.SpecialCharacterDialog){
      win.characters = {}; // luckily this preempts the generation of the default spacial characters list
      opening.then(function(){
        //in case the implementation of SpecialCharacterDialog change in the future
      }).progress(function(data){
        if(data.state == 'ready' && mychars){
          win.characters = mychars;
          win.buildButtonList();
          surface.toolbarDialogs.off('opening', dialogopen);
        }  
      })
    }
  }

  surface.toolbarDialogs.on('opening', dialogopen);                  
});