[ Index ]

PHP Cross Reference of moodle-2.8

title

Body

[close]

/lib/editor/tinymce/plugins/moodleemoticon/tinymce/js/ -> dialog.js (source)

   1  var MoodleEmoticonDialog = {
   2  
   3      init : function() {
   4          // Register event handlers for the table rows.
   5          tinymce.each(tinymce.DOM.select('tr.emoticoninfo', document), function(row) {
   6  
   7              tinymce.dom.Event.add(row, 'mouseover', function(e) {
   8                  this.style.backgroundColor = 'white';
   9              }, row);
  10  
  11              tinymce.dom.Event.add(row, 'mouseout', function(e) {
  12                  this.style.backgroundColor = 'transparent';
  13              }, row);
  14  
  15              tinymce.dom.Event.add(row, 'click', function(e) {
  16                  var matches = /^emoticoninfo emoticoninfo-index-([0-9]+)$/.exec(this.className);
  17                  if (matches.length != 2) {
  18                      // continue with the next row
  19                      return true;
  20                  }
  21                  var index = matches[1];
  22                  MoodleEmoticonDialog.insert(index);
  23              }, row);
  24  
  25          });
  26      },
  27  
  28      insert : function(index) {
  29          emoticons = tinyMCEPopup.editor._emoticons;
  30          i = 0;
  31          for (var emoticon in emoticons) {
  32              if (i == index) {
  33                  if (tinymce.isIE) {
  34                      tinyMCEPopup.restoreSelection();
  35                  }
  36                  tinyMCEPopup.editor.execCommand('mceInsertContent', false, emoticons[emoticon]);
  37                  tinyMCEPopup.close();
  38                  return;
  39              }
  40              i++;
  41          }
  42      },
  43  
  44      highlight : function(row) {
  45          row.style.backgroundColor="white";
  46      },
  47  
  48      unhighlight : function(row) {
  49          row.style.backgroundColor="transparent";
  50      }
  51  
  52  };
  53  
  54  tinyMCEPopup.onInit.add(MoodleEmoticonDialog.init, MoodleEmoticonDialog);


Generated: Fri Nov 28 20:29:05 2014 Cross-referenced by PHPXref 0.7.1