/[drupal]/contributions/modules/chipin/js/chipin.js
ViewVC logotype

Diff of /contributions/modules/chipin/js/chipin.js

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.2, Mon Aug 28 20:19:33 2006 UTC revision 1.3, Thu Aug 31 20:26:54 2006 UTC
# Line 1  Line 1 
1  // $Id: $  // $Id: chipin.js,v 1.2 2006/08/28 20:19:33 robroy Exp $
2    
3  /**  /**
4   * Browser detection script originally created   * Browser detection script originally created
5   * by Peter Paul Koch at http://www.quirksmode.org/   * by Peter Paul Koch at http://www.quirksmode.org/
6   */   */
7  function getBrowserInfo()  function getBrowserInfo()
# Line 43  else if (browserType == "Safari") Line 43  else if (browserType == "Safari")
43    
44    
45  function addEvent(obj, evType, fn)  function addEvent(obj, evType, fn)
46  {  {
47          if (obj.addEventListener) {          if (obj.addEventListener) {
48                  obj.addEventListener(evType, fn, true);                  obj.addEventListener(evType, fn, true);
49                  return true;                  return true;
50          } else if (obj.attachEvent) {          } else if (obj.attachEvent) {
51                  var r = obj.attachEvent("on" + evType, fn);                  var r = obj.attachEvent("on" + evType, fn);
52                  return r;                  return r;
# Line 173  function isColor(testcolor) Line 173  function isColor(testcolor)
173          return false;          return false;
174  }  }
175    
176    function isValidEventID(testeventid)
177    {
178            validID = false;
179            if (testeventid && testeventid.length >= 16) {
180                    matches = testeventid.match(/([a-zA-Z0-9]{16})/g);
181                    if (matches)
182                validID = true;
183            }
184            return validID;
185    }
186    
187  function setWidgetLayout(num)  function setWidgetLayout(num)
188  {  {
189          if (num == 1) {          if (num == 1) {
# Line 430  function findPosY(obj) Line 441  function findPosY(obj)
441    
442  function insertWidgetCode()  function insertWidgetCode()
443  {  {
444    if (window.opener) {          var formObj = document.forms[0];
445            var eventID = formObj['edit-event_id'].value;
446      if (!isValidEventID(eventID)) {
447            alert('Please enter a valid ChipIn event ID.');
448                    return false;
449      } else if (window.opener) {
450      // Get variables from the fields on the properties frame      // Get variables from the fields on the properties frame
     var formObj = document.forms[0];  
451                  var content = formObj['edit-widgettag'].value;                  var content = formObj['edit-widgettag'].value;
452                  insertToEditor(content);                  insertToEditor(content);
453                  return false;                  return false;

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

  ViewVC Help
Powered by ViewVC 1.1.2