web/data/cubicweb.timeline-bundle.js
changeset 5470 fb004819cab4
parent 2097 400bdbcc5699
child 5774 0d792bceb25d
equal deleted inserted replaced
5468:7199fddc0a88 5470:fb004819cab4
     1 var SimileAjax_urlPrefix = baseuri() + 'data/';
     1 var SimileAjax_urlPrefix = baseuri() + 'data/';
     2 var Timeline_urlPrefix = baseuri() + 'data/';
     2 var Timeline_urlPrefix = baseuri() + 'data/';
     3 
     3 
     4 /*==================================================
     4 /*
     5  *  Simile Ajax API
     5  *  Simile Ajax API
     6  *
     6  *
     7  *  Include this file in your HTML file as follows:
     7  *  Include this file in your HTML file as follows:
     8  *
     8  *
     9  *    <script src="http://simile.mit.edu/ajax/api/simile-ajax-api.js" type="text/javascript"></script>
     9  *    <script src="http://simile.mit.edu/ajax/api/simile-ajax-api.js" type="text/javascript"></script>
    10  *
    10  *
    11  *==================================================
    11  *
    12  */
    12  */
    13 
    13 
    14 if (typeof SimileAjax == "undefined") {
    14 if (typeof SimileAjax == "undefined") {
    15     var SimileAjax = {
    15     var SimileAjax = {
    16         loaded:                 false,
    16         loaded:                 false,
   211 //         SimileAjax.includeCssFiles(document, SimileAjax.urlPrefix + "styles/", cssFiles);
   211 //         SimileAjax.includeCssFiles(document, SimileAjax.urlPrefix + "styles/", cssFiles);
   212 
   212 
   213         SimileAjax.loaded = true;
   213         SimileAjax.loaded = true;
   214     })();
   214     })();
   215 }
   215 }
   216 /*==================================================
   216 /*
   217  *  Platform Utility Functions and Constants
   217  *  Platform Utility Functions and Constants
   218  *==================================================
   218  *
   219  */
   219  */
   220 
   220 
   221 /*  This must be called after our jQuery has been loaded
   221 /*  This must be called after our jQuery has been loaded
   222     but before control returns to user-code.
   222     but before control returns to user-code.
   223 */
   223 */
   317     }
   317     }
   318 })();
   318 })();
   319 
   319 
   320 SimileAjax.Platform.getDefaultLocale = function() {
   320 SimileAjax.Platform.getDefaultLocale = function() {
   321     return SimileAjax.Platform.clientLocale;
   321     return SimileAjax.Platform.clientLocale;
   322 };/*==================================================
   322 };
       
   323 /*
   323  *  Debug Utility Functions
   324  *  Debug Utility Functions
   324  *==================================================
   325  *
   325  */
   326  */
   326 
   327 
   327 SimileAjax.Debug = {
   328 SimileAjax.Debug = {
   328     silent: false
   329     silent: false
   329 };
   330 };
   676         } catch (e) {
   677         } catch (e) {
   677             return false;
   678             return false;
   678         }
   679         }
   679     };
   680     };
   680 })();
   681 })();
   681 /*==================================================
   682 /*
   682  *  DOM Utility Functions
   683  *  DOM Utility Functions
   683  *==================================================
   684  *
   684  */
   685  */
   685 
   686 
   686 SimileAjax.DOM = new Object();
   687 SimileAjax.DOM = new Object();
   687 
   688 
   688 SimileAjax.DOM.registerEventWithObject = function(elmt, eventName, obj, handlerName) {
   689 SimileAjax.DOM.registerEventWithObject = function(elmt, eventName, obj, handlerName) {
  1038 SimileAjax.Graphics.pngIsTranslucent = (!SimileAjax.Platform.browser.isIE) || (SimileAjax.Platform.browser.majorVersion > 6);
  1039 SimileAjax.Graphics.pngIsTranslucent = (!SimileAjax.Platform.browser.isIE) || (SimileAjax.Platform.browser.majorVersion > 6);
  1039 if (!SimileAjax.Graphics.pngIsTranslucent) {
  1040 if (!SimileAjax.Graphics.pngIsTranslucent) {
  1040     SimileAjax.includeCssFile(document, SimileAjax.urlPrefix + "styles/graphics-ie6.css");
  1041     SimileAjax.includeCssFile(document, SimileAjax.urlPrefix + "styles/graphics-ie6.css");
  1041 }
  1042 }
  1042 
  1043 
  1043 /*==================================================
  1044 /*
  1044  *  Opacity, translucency
  1045  *  Opacity, translucency
  1045  *==================================================
  1046  *
  1046  */
  1047  */
  1047 SimileAjax.Graphics._createTranslucentImage1 = function(url, verticalAlign) {
  1048 SimileAjax.Graphics._createTranslucentImage1 = function(url, verticalAlign) {
  1048     var elmt = document.createElement("img");
  1049     var elmt = document.createElement("img");
  1049     elmt.setAttribute("src", url);
  1050     elmt.setAttribute("src", url);
  1050     if (verticalAlign != null) {
  1051     if (verticalAlign != null) {
  1117         elmt.style.opacity = o;
  1118         elmt.style.opacity = o;
  1118         elmt.style.MozOpacity = o;
  1119         elmt.style.MozOpacity = o;
  1119     }
  1120     }
  1120 };
  1121 };
  1121 
  1122 
  1122 /*==================================================
  1123 /*
  1123  *  Bubble
  1124  *  Bubble
  1124  *==================================================
  1125  *
  1125  */
  1126  */
  1126 
  1127 
  1127 SimileAjax.Graphics.bubbleConfig = {
  1128 SimileAjax.Graphics.bubbleConfig = {
  1128     containerCSSClass:              "simileAjax-bubble-container",
  1129     containerCSSClass:              "simileAjax-bubble-container",
  1129     innerContainerCSSClass:         "simileAjax-bubble-innerContainer",
  1130     innerContainerCSSClass:         "simileAjax-bubble-innerContainer",
  1477         containerDiv:   containerDiv,
  1478         containerDiv:   containerDiv,
  1478         contentDiv:     contentDiv
  1479         contentDiv:     contentDiv
  1479     };
  1480     };
  1480 };
  1481 };
  1481 
  1482 
  1482 /*==================================================
  1483 /*
  1483  *  Animation
  1484  *  Animation
  1484  *==================================================
  1485  *
  1485  */
  1486  */
  1486 
  1487 
  1487 /**
  1488 /**
  1488  * Creates an animation for a function, and an interval of values.  The word
  1489  * Creates an animation for a function, and an interval of values.  The word
  1489  * "animation" here is used in the sense of repeatedly calling a function with
  1490  * "animation" here is used in the sense of repeatedly calling a function with
  1547         this.f(this.to, 0);
  1548         this.f(this.to, 0);
  1548         this["cont"]();
  1549         this["cont"]();
  1549     }
  1550     }
  1550 };
  1551 };
  1551 
  1552 
  1552 /*==================================================
  1553 /*
  1553  *  CopyPasteButton
  1554  *  CopyPasteButton
  1554  *
  1555  *
  1555  *  Adapted from http://spaces.live.com/editorial/rayozzie/demo/liveclip/liveclipsample/techPreview.html.
  1556  *  Adapted from http://spaces.live.com/editorial/rayozzie/demo/liveclip/liveclipsample/techPreview.html.
  1556  *==================================================
  1557  *
  1557  */
  1558  */
  1558 
  1559 
  1559 /**
  1560 /**
  1560  * Creates a button and textarea for displaying structured data and copying it
  1561  * Creates a button and textarea for displaying structured data and copying it
  1561  * to the clipboard.  The data is dynamically generated by the given
  1562  * to the clipboard.  The data is dynamically generated by the given
  1604     };
  1605     };
  1605 
  1606 
  1606     return div;
  1607     return div;
  1607 };
  1608 };
  1608 
  1609 
  1609 /*==================================================
  1610 /*
  1610  *  getWidthHeight
  1611  *  getWidthHeight
  1611  *==================================================
  1612  *
  1612  */
  1613  */
  1613 SimileAjax.Graphics.getWidthHeight = function(el) {
  1614 SimileAjax.Graphics.getWidthHeight = function(el) {
  1614     // RETURNS hash {width:  w, height: h} in pixels
  1615     // RETURNS hash {width:  w, height: h} in pixels
  1615 
  1616 
  1616     var w, h;
  1617     var w, h;
  1631         height: h
  1632         height: h
  1632     };
  1633     };
  1633 };
  1634 };
  1634 
  1635 
  1635 
  1636 
  1636 /*==================================================
  1637 /*
  1637  *  FontRenderingContext
  1638  *  FontRenderingContext
  1638  *==================================================
  1639  *
  1639  */
  1640  */
  1640 SimileAjax.Graphics.getFontRenderingContext = function(elmt, width) {
  1641 SimileAjax.Graphics.getFontRenderingContext = function(elmt, width) {
  1641     return new SimileAjax.Graphics._FontRenderingContext(elmt, width);
  1642     return new SimileAjax.Graphics._FontRenderingContext(elmt, width);
  1642 };
  1643 };
  1643 
  1644 
  2125  */
  2126  */
  2126 SimileAjax.DateTime.getTimezone = function() {
  2127 SimileAjax.DateTime.getTimezone = function() {
  2127     var d = new Date().getTimezoneOffset();
  2128     var d = new Date().getTimezoneOffset();
  2128     return d / -60;
  2129     return d / -60;
  2129 };
  2130 };
  2130 /*==================================================
  2131 /*
  2131  *  String Utility Functions and Constants
  2132  *  String Utility Functions and Constants
  2132  *==================================================
  2133  *
  2133  */
  2134  */
  2134 
  2135 
  2135 String.prototype.trim = function() {
  2136 String.prototype.trim = function() {
  2136     return this.replace(/^\s+|\s+$/g, '');
  2137     return this.replace(/^\s+|\s+$/g, '');
  2137 };
  2138 };
  2168     if (start < s.length) {
  2169     if (start < s.length) {
  2169         result += s.substring(start);
  2170         result += s.substring(start);
  2170     }
  2171     }
  2171     return result;
  2172     return result;
  2172 };
  2173 };
  2173 /*==================================================
  2174 /*
  2174  *  HTML Utility Functions
  2175  *  HTML Utility Functions
  2175  *==================================================
  2176  *
  2176  */
  2177  */
  2177 
  2178 
  2178 SimileAjax.HTML = new Object();
  2179 SimileAjax.HTML = new Object();
  2179 
  2180 
  2180 SimileAjax.HTML._e2uHash = {};
  2181 SimileAjax.HTML._e2uHash = {};
  2653 
  2654 
  2654 SimileAjax.SortedArray.prototype.getLast = function() {
  2655 SimileAjax.SortedArray.prototype.getLast = function() {
  2655     return (this._a.length > 0) ? this._a[this._a.length - 1] : null;
  2656     return (this._a.length > 0) ? this._a[this._a.length - 1] : null;
  2656 };
  2657 };
  2657 
  2658 
  2658 /*==================================================
  2659 /*
  2659  *  Event Index
  2660  *  Event Index
  2660  *==================================================
  2661  *
  2661  */
  2662  */
  2662 
  2663 
  2663 SimileAjax.EventIndex = function(unit) {
  2664 SimileAjax.EventIndex = function(unit) {
  2664     var eventIndex = this;
  2665     var eventIndex = this;
  2665 
  2666 
  2887     },
  2888     },
  2888     next: function() {
  2889     next: function() {
  2889         return this._index < this._events.length() ?
  2890         return this._index < this._events.length() ?
  2890             this._events.elementAt(this._index++) : null;
  2891             this._events.elementAt(this._index++) : null;
  2891     }
  2892     }
  2892 };/*==================================================
  2893 };/*
  2893  *  Default Unit
  2894  *  Default Unit
  2894  *==================================================
  2895  *
  2895  */
  2896  */
  2896 
  2897 
  2897 SimileAjax.NativeDateUnit = new Object();
  2898 SimileAjax.NativeDateUnit = new Object();
  2898 
  2899 
  2899 SimileAjax.NativeDateUnit.makeDefaultValue = function() {
  2900 SimileAjax.NativeDateUnit.makeDefaultValue = function() {
  2951 
  2952 
  2952 SimileAjax.NativeDateUnit.change = function(v, n) {
  2953 SimileAjax.NativeDateUnit.change = function(v, n) {
  2953     return new Date(v.getTime() + n);
  2954     return new Date(v.getTime() + n);
  2954 };
  2955 };
  2955 
  2956 
  2956 /*==================================================
  2957 /*
  2957  *  General, miscellaneous SimileAjax stuff
  2958  *  General, miscellaneous SimileAjax stuff
  2958  *==================================================
  2959  *
  2959  */
  2960  */
  2960 
  2961 
  2961 SimileAjax.ListenerQueue = function(wildcardHandlerName) {
  2962 SimileAjax.ListenerQueue = function(wildcardHandlerName) {
  2962     this._listeners = [];
  2963     this._listeners = [];
  2963     this._wildcardHandlerName = wildcardHandlerName;
  2964     this._wildcardHandlerName = wildcardHandlerName;
  2996             }
  2997             }
  2997         }
  2998         }
  2998     }
  2999     }
  2999 };
  3000 };
  3000 
  3001 
  3001 /*======================================================================
  3002 /*
  3002  *  History
  3003  *  History
  3003  *
  3004  *
  3004  *  This is a singleton that keeps track of undoable user actions and
  3005  *  This is a singleton that keeps track of undoable user actions and
  3005  *  performs undos and redos in response to the browser's Back and
  3006  *  performs undos and redos in response to the browser's Back and
  3006  *  Forward buttons.
  3007  *  Forward buttons.
  3018  *      SimileAjax.History.maxHistoryLength
  3019  *      SimileAjax.History.maxHistoryLength
  3019  *  to a different number.
  3020  *  to a different number.
  3020  *
  3021  *
  3021  *  An iframe is inserted into the document's body element to track
  3022  *  An iframe is inserted into the document's body element to track
  3022  *  onload events.
  3023  *  onload events.
  3023  *======================================================================
  3024  *
  3024  */
  3025  */
  3025 
  3026 
  3026 SimileAjax.History = {
  3027 SimileAjax.History = {
  3027     maxHistoryLength:       10,
  3028     maxHistoryLength:       10,
  3028     historyFile:            "__history__.html",
  3029     historyFile:            "__history__.html",
  3630         }
  3631         }
  3631         elmt = elmt.parentNode;
  3632         elmt = elmt.parentNode;
  3632     }
  3633     }
  3633     return elmt;
  3634     return elmt;
  3634 };
  3635 };
  3635 /*==================================================
  3636 /*
  3636  *  Timeline API
  3637  *  Timeline API
  3637  *
  3638  *
  3638  *  This file will load all the Javascript files
  3639  *  This file will load all the Javascript files
  3639  *  necessary to make the standard timeline work.
  3640  *  necessary to make the standard timeline work.
  3640  *  It also detects the default locale.
  3641  *  It also detects the default locale.
  3694  *   <script src="http://api.simile-widgets.org/timeline/2.3.1/api/timeline-api.js?bundle=false" type="text/javascript"></script>
  3695  *   <script src="http://api.simile-widgets.org/timeline/2.3.1/api/timeline-api.js?bundle=false" type="text/javascript"></script>
  3695  *
  3696  *
  3696  * Note that the Ajax version is usually NOT the same as the Timeline version.
  3697  * Note that the Ajax version is usually NOT the same as the Timeline version.
  3697  * See variable simile_ajax_ver below for the current version
  3698  * See variable simile_ajax_ver below for the current version
  3698  *
  3699  *
  3699  *==================================================
  3700  *
  3700  */
  3701  */
  3701 
  3702 
  3702 (function() {
  3703 (function() {
  3703 
  3704 
  3704     var simile_ajax_ver = "2.2.1"; // ===========>>>  current Simile-Ajax version
  3705     var simile_ajax_ver = "2.2.1"; // ===========>>>  current Simile-Ajax version
  3926         }
  3927         }
  3927     } else {
  3928     } else {
  3928         loadMe();
  3929         loadMe();
  3929     }
  3930     }
  3930 })();
  3931 })();
  3931 /*=================================================
  3932 /*
  3932  *
  3933  *
  3933  * Coding standards:
  3934  * Coding standards:
  3934  *
  3935  *
  3935  * We aim towards Douglas Crockford's Javascript conventions.
  3936  * We aim towards Douglas Crockford's Javascript conventions.
  3936  * See:  http://javascript.crockford.com/code.html
  3937  * See:  http://javascript.crockford.com/code.html
  3948  * which enforce privacy in objects.
  3949  * which enforce privacy in objects.
  3949  *
  3950  *
  3950  * We also want to use jslint:  http://www.jslint.com/
  3951  * We also want to use jslint:  http://www.jslint.com/
  3951  *
  3952  *
  3952  *
  3953  *
  3953  *==================================================
  3954  *
  3954  */
  3955  */
  3955 
  3956 
  3956 
  3957 
  3957 
  3958 
  3958 /*==================================================
  3959 /*
  3959  *  Timeline VERSION
  3960  *  Timeline VERSION
  3960  *==================================================
  3961  *
  3961  */
  3962  */
  3962 // Note: version is also stored in the build.xml file
  3963 // Note: version is also stored in the build.xml file
  3963 Timeline.version = 'pre 2.4.0';  // use format 'pre 1.2.3' for trunk versions
  3964 Timeline.version = 'pre 2.4.0';  // use format 'pre 1.2.3' for trunk versions
  3964 Timeline.ajax_lib_version = SimileAjax.version;
  3965 Timeline.ajax_lib_version = SimileAjax.version;
  3965 Timeline.display_version = Timeline.version + ' (with Ajax lib ' + Timeline.ajax_lib_version + ')';
  3966 Timeline.display_version = Timeline.version + ' (with Ajax lib ' + Timeline.ajax_lib_version + ')';
  3966  // cf method Timeline.writeVersion
  3967  // cf method Timeline.writeVersion
  3967 
  3968 
  3968 /*==================================================
  3969 /*
  3969  *  Timeline
  3970  *  Timeline
  3970  *==================================================
  3971  *
  3971  */
  3972  */
  3972 Timeline.strings = {}; // localization string tables
  3973 Timeline.strings = {}; // localization string tables
  3973 Timeline.HORIZONTAL = 0;
  3974 Timeline.HORIZONTAL = 0;
  3974 Timeline.VERTICAL = 1;
  3975 Timeline.VERTICAL = 1;
  3975 Timeline._defaultTheme = null;
  3976 Timeline._defaultTheme = null;
  4181   document.getElementById(el_id).innerHTML = this.display_version;
  4182   document.getElementById(el_id).innerHTML = this.display_version;
  4182 };
  4183 };
  4183 
  4184 
  4184 
  4185 
  4185 
  4186 
  4186 /*==================================================
  4187 /*
  4187  *  Timeline Implementation object
  4188  *  Timeline Implementation object
  4188  *==================================================
  4189  *
  4189  */
  4190  */
  4190 Timeline._Impl = function(elmt, bandInfos, orientation, unit, timelineID) {
  4191 Timeline._Impl = function(elmt, bandInfos, orientation, unit, timelineID) {
  4191     SimileAjax.WindowManager.initialize();
  4192     SimileAjax.WindowManager.initialize();
  4192 
  4193 
  4193     this._containerDiv = elmt;
  4194     this._containerDiv = elmt;
  4583   }
  4584   }
  4584 
  4585 
  4585   this.paint();
  4586   this.paint();
  4586 };
  4587 };
  4587 
  4588 
  4588 /*=================================================
  4589 /*
  4589  *
  4590  *
  4590  * Coding standards:
  4591  * Coding standards:
  4591  *
  4592  *
  4592  * We aim towards Douglas Crockford's Javascript conventions.
  4593  * We aim towards Douglas Crockford's Javascript conventions.
  4593  * See:  http://javascript.crockford.com/code.html
  4594  * See:  http://javascript.crockford.com/code.html
  4605  * which enforce privacy in objects.
  4606  * which enforce privacy in objects.
  4606  *
  4607  *
  4607  * We also want to use jslint:  http://www.jslint.com/
  4608  * We also want to use jslint:  http://www.jslint.com/
  4608  *
  4609  *
  4609  *
  4610  *
  4610  *==================================================
  4611  *
  4611  */
  4612  */
  4612 
  4613 
  4613 
  4614 
  4614 
  4615 
  4615 /*==================================================
  4616 /*
  4616  *  Band
  4617  *  Band
  4617  *==================================================
  4618  *
  4618  */
  4619  */
  4619 Timeline._Band = function(timeline, bandInfo, index) {
  4620 Timeline._Band = function(timeline, bandInfo, index) {
  4620     // hack for easier subclassing
  4621     // hack for easier subclassing
  4621     if (timeline !== undefined) {
  4622     if (timeline !== undefined) {
  4622         this.initialize(timeline, bandInfo, index);
  4623         this.initialize(timeline, bandInfo, index);
  5342 };
  5343 };
  5343 
  5344 
  5344 Timeline._Band.prototype.closeBubble = function() {
  5345 Timeline._Band.prototype.closeBubble = function() {
  5345     SimileAjax.WindowManager.cancelPopups();
  5346     SimileAjax.WindowManager.cancelPopups();
  5346 };
  5347 };
  5347 /*==================================================
  5348 /*
  5348  *  Classic Theme
  5349  *  Classic Theme
  5349  *==================================================
  5350  *
  5350  */
  5351  */
  5351 
  5352 
  5352 
  5353 
  5353 
  5354 
  5354 Timeline.ClassicTheme = new Object();
  5355 Timeline.ClassicTheme = new Object();
  5521             }
  5522             }
  5522         }
  5523         }
  5523     };
  5524     };
  5524 
  5525 
  5525     this.mouseWheel = 'scroll'; // 'default', 'zoom', 'scroll'
  5526     this.mouseWheel = 'scroll'; // 'default', 'zoom', 'scroll'
  5526 };/*==================================================
  5527 };/*
  5527  *  An "ether" is a object that maps date/time to pixel coordinates.
  5528  *  An "ether" is a object that maps date/time to pixel coordinates.
  5528  *==================================================
  5529  *
  5529  */
  5530  */
  5530 
  5531 
  5531 /*==================================================
  5532 /*
  5532  *  Linear Ether
  5533  *  Linear Ether
  5533  *==================================================
  5534  *
  5534  */
  5535  */
  5535 
  5536 
  5536 Timeline.LinearEther = function(params) {
  5537 Timeline.LinearEther = function(params) {
  5537     this._params = params;
  5538     this._params = params;
  5538     this._interval = params.interval;
  5539     this._interval = params.interval;
  5599 
  5600 
  5600   return netIntervalChange;
  5601   return netIntervalChange;
  5601 };
  5602 };
  5602 
  5603 
  5603 
  5604 
  5604 /*==================================================
  5605 /*
  5605  *  Hot Zone Ether
  5606  *  Hot Zone Ether
  5606  *==================================================
  5607  *
  5607  */
  5608  */
  5608 
  5609 
  5609 Timeline.HotZoneEther = function(params) {
  5610 Timeline.HotZoneEther = function(params) {
  5610     this._params = params;
  5611     this._params = params;
  5611     this._interval = params.interval;
  5612     this._interval = params.interval;
  5826 };
  5827 };
  5827 
  5828 
  5828 Timeline.HotZoneEther.prototype._getScale = function() {
  5829 Timeline.HotZoneEther.prototype._getScale = function() {
  5829     return this._interval / this._pixelsPerInterval;
  5830     return this._interval / this._pixelsPerInterval;
  5830 };
  5831 };
  5831 /*==================================================
  5832 /*
  5832  *  Gregorian Ether Painter
  5833  *  Gregorian Ether Painter
  5833  *==================================================
  5834  *
  5834  */
  5835  */
  5835 
  5836 
  5836 Timeline.GregorianEtherPainter = function(params) {
  5837 Timeline.GregorianEtherPainter = function(params) {
  5837     this._params = params;
  5838     this._params = params;
  5838     this._theme = params.theme;
  5839     this._theme = params.theme;
  5917     this._unit += netIntervalChange;
  5918     this._unit += netIntervalChange;
  5918   }
  5919   }
  5919 };
  5920 };
  5920 
  5921 
  5921 
  5922 
  5922 /*==================================================
  5923 /*
  5923  *  Hot Zone Gregorian Ether Painter
  5924  *  Hot Zone Gregorian Ether Painter
  5924  *==================================================
  5925  *
  5925  */
  5926  */
  5926 
  5927 
  5927 Timeline.HotZoneGregorianEtherPainter = function(params) {
  5928 Timeline.HotZoneGregorianEtherPainter = function(params) {
  5928     this._params = params;
  5929     this._params = params;
  5929     this._theme = params.theme;
  5930     this._theme = params.theme;
  6078       }
  6079       }
  6079     }
  6080     }
  6080   }
  6081   }
  6081 };
  6082 };
  6082 
  6083 
  6083 /*==================================================
  6084 /*
  6084  *  Year Count Ether Painter
  6085  *  Year Count Ether Painter
  6085  *==================================================
  6086  *
  6086  */
  6087  */
  6087 
  6088 
  6088 Timeline.YearCountEtherPainter = function(params) {
  6089 Timeline.YearCountEtherPainter = function(params) {
  6089     this._params = params;
  6090     this._params = params;
  6090     this._theme = params.theme;
  6091     this._theme = params.theme;
  6167 };
  6168 };
  6168 
  6169 
  6169 Timeline.YearCountEtherPainter.prototype.softPaint = function() {
  6170 Timeline.YearCountEtherPainter.prototype.softPaint = function() {
  6170 };
  6171 };
  6171 
  6172 
  6172 /*==================================================
  6173 /*
  6173  *  Quarterly Ether Painter
  6174  *  Quarterly Ether Painter
  6174  *==================================================
  6175  *
  6175  */
  6176  */
  6176 
  6177 
  6177 Timeline.QuarterlyEtherPainter = function(params) {
  6178 Timeline.QuarterlyEtherPainter = function(params) {
  6178     this._params = params;
  6179     this._params = params;
  6179     this._theme = params.theme;
  6180     this._theme = params.theme;
  6255 };
  6256 };
  6256 
  6257 
  6257 Timeline.QuarterlyEtherPainter.prototype.softPaint = function() {
  6258 Timeline.QuarterlyEtherPainter.prototype.softPaint = function() {
  6258 };
  6259 };
  6259 
  6260 
  6260 /*==================================================
  6261 /*
  6261  *  Ether Interval Marker Layout
  6262  *  Ether Interval Marker Layout
  6262  *==================================================
  6263  *
  6263  */
  6264  */
  6264 
  6265 
  6265 Timeline.EtherIntervalMarkerLayout = function(timeline, band, theme, align, showLine) {
  6266 Timeline.EtherIntervalMarkerLayout = function(timeline, band, theme, align, showLine) {
  6266     var horizontal = timeline.isHorizontal();
  6267     var horizontal = timeline.isHorizontal();
  6267     if (horizontal) {
  6268     if (horizontal) {
  6361 
  6362 
  6362         return div;
  6363         return div;
  6363     };
  6364     };
  6364 };
  6365 };
  6365 
  6366 
  6366 /*==================================================
  6367 /*
  6367  *  Ether Highlight Layout
  6368  *  Ether Highlight Layout
  6368  *==================================================
  6369  *
  6369  */
  6370  */
  6370 
  6371 
  6371 Timeline.EtherHighlight = function(timeline, band, theme, backgroundLayer) {
  6372 Timeline.EtherHighlight = function(timeline, band, theme, backgroundLayer) {
  6372     var horizontal = timeline.isHorizontal();
  6373     var horizontal = timeline.isHorizontal();
  6373 
  6374 
  6402             this._highlightDiv.style.height = length + "px";
  6403             this._highlightDiv.style.height = length + "px";
  6403             this._highlightDiv.style.width = (band.getViewWidth() - 4) + "px";
  6404             this._highlightDiv.style.width = (band.getViewWidth() - 4) + "px";
  6404         }
  6405         }
  6405     }
  6406     }
  6406 };
  6407 };
  6407 /*==================================================
  6408 /*
  6408  *  Event Utils
  6409  *  Event Utils
  6409  *==================================================
  6410  *
  6410  */
  6411  */
  6411 Timeline.EventUtils = {};
  6412 Timeline.EventUtils = {};
  6412 
  6413 
  6413 Timeline.EventUtils.getNewEventID = function() {
  6414 Timeline.EventUtils.getNewEventID = function() {
  6414     // global across page
  6415     // global across page
  6419     this._lastEventID += 1;
  6420     this._lastEventID += 1;
  6420     return "e" + this._lastEventID;
  6421     return "e" + this._lastEventID;
  6421 };
  6422 };
  6422 
  6423 
  6423 Timeline.EventUtils.decodeEventElID = function(elementID) {
  6424 Timeline.EventUtils.decodeEventElID = function(elementID) {
  6424     /*==================================================
  6425     /*
  6425      *
  6426      *
  6426      * Use this function to decode an event element's id on a band (label div,
  6427      * Use this function to decode an event element's id on a band (label div,
  6427      * tape div or icon img).
  6428      * tape div or icon img).
  6428      *
  6429      *
  6429      * Returns {band: <bandObj>, evt: <eventObj>}
  6430      * Returns {band: <bandObj>, evt: <eventObj>}
  6445      *
  6446      *
  6446      * You can then retrieve the timeline object and event object
  6447      * You can then retrieve the timeline object and event object
  6447      * by using Timeline.getTimeline, Timeline.getBand, or
  6448      * by using Timeline.getTimeline, Timeline.getBand, or
  6448      * Timeline.getEvent and passing in the element's id
  6449      * Timeline.getEvent and passing in the element's id
  6449      *
  6450      *
  6450      *==================================================
  6451      *
  6451      */
  6452      */
  6452 
  6453 
  6453     var parts = elementID.split('-');
  6454     var parts = elementID.split('-');
  6454     if (parts[1] != 'tl') {
  6455     if (parts[1] != 'tl') {
  6455         alert("Internal Timeline problem 101, please consult support");
  6456         alert("Internal Timeline problem 101, please consult support");
  6465 
  6466 
  6466 Timeline.EventUtils.encodeEventElID = function(timeline, band, elType, evt) {
  6467 Timeline.EventUtils.encodeEventElID = function(timeline, band, elType, evt) {
  6467     // elType should be one of {label | icon | tapeN | highlightN}
  6468     // elType should be one of {label | icon | tapeN | highlightN}
  6468     return elType + "-tl-" + timeline.timelineID +
  6469     return elType + "-tl-" + timeline.timelineID +
  6469        "-" + band.getIndex() + "-" + evt.getID();
  6470        "-" + band.getIndex() + "-" + evt.getID();
  6470 };/*==================================================
  6471 };/*
  6471  *  Gregorian Date Labeller
  6472  *  Gregorian Date Labeller
  6472  *==================================================
  6473  *
  6473  */
  6474  */
  6474 
  6475 
  6475 Timeline.GregorianDateLabeller = function(locale, timeZone) {
  6476 Timeline.GregorianDateLabeller = function(locale, timeZone) {
  6476     this._locale = locale;
  6477     this._locale = locale;
  6477     this._timeZone = timeZone;
  6478     this._timeZone = timeZone;
  6556         text = date.toUTCString();
  6557         text = date.toUTCString();
  6557     }
  6558     }
  6558     return { text: text, emphasized: emphasized };
  6559     return { text: text, emphasized: emphasized };
  6559 }
  6560 }
  6560 
  6561 
  6561 /*==================================================
  6562 /*
  6562  *  Default Event Source
  6563  *  Default Event Source
  6563  *==================================================
  6564  *
  6564  */
  6565  */
  6565 
  6566 
  6566 
  6567 
  6567 Timeline.DefaultEventSource = function(eventIndex) {
  6568 Timeline.DefaultEventSource = function(eventIndex) {
  6568     this._events = (eventIndex instanceof Object) ? eventIndex : new SimileAjax.EventIndex();
  6569     this._events = (eventIndex instanceof Object) ? eventIndex : new SimileAjax.EventIndex();
  7123         elmt.appendChild(divWiki);
  7124         elmt.appendChild(divWiki);
  7124     }
  7125     }
  7125 };
  7126 };
  7126 
  7127 
  7127 
  7128 
  7128 /*==================================================
  7129 /*
  7129  *  Original Event Painter
  7130  *  Original Event Painter
  7130  *==================================================
  7131  *
  7131  */
  7132  */
  7132 
  7133 
  7133 /*==================================================
  7134 /*
  7134  *
  7135  *
  7135  * To enable a single event listener to monitor everything
  7136  * To enable a single event listener to monitor everything
  7136  * on a Timeline, we need a way to map from an event's icon,
  7137  * on a Timeline, we need a way to map from an event's icon,
  7137  * label or tape element to the associated timeline, band and
  7138  * label or tape element to the associated timeline, band and
  7138  * specific event.
  7139  * specific event.
  7150  *               highlight2-tl-<timelineID>-<band_index>-<evt.id>
  7151  *               highlight2-tl-<timelineID>-<band_index>-<evt.id>
  7151  *           // some events have more than one highlight div (future)
  7152  *           // some events have more than one highlight div (future)
  7152  * You can then retrieve the band/timeline objects and event object
  7153  * You can then retrieve the band/timeline objects and event object
  7153  * by using Timeline.EventUtils.decodeEventElID
  7154  * by using Timeline.EventUtils.decodeEventElID
  7154  *
  7155  *
  7155  *==================================================
  7156  *
  7156  */
  7157  */
  7157 
  7158 
  7158 /*
  7159 /*
  7159  *    eventPaintListener functions receive calls about painting.
  7160  *    eventPaintListener functions receive calls about painting.
  7160  *    function(band, op, evt, els)
  7161  *    function(band, op, evt, els)
  7816 Timeline.OriginalEventPainter.prototype._fireEventPaintListeners = function(op, evt, els) {
  7817 Timeline.OriginalEventPainter.prototype._fireEventPaintListeners = function(op, evt, els) {
  7817     for (var i = 0; i < this._eventPaintListeners.length; i++) {
  7818     for (var i = 0; i < this._eventPaintListeners.length; i++) {
  7818         this._eventPaintListeners[i](this._band, op, evt, els);
  7819         this._eventPaintListeners[i](this._band, op, evt, els);
  7819     }
  7820     }
  7820 };
  7821 };
  7821 /*==================================================
  7822 /*
  7822  *  Detailed Event Painter
  7823  *  Detailed Event Painter
  7823  *==================================================
  7824  *
  7824  */
  7825  */
  7825 
  7826 
  7826 // Note: a number of features from original-painter
  7827 // Note: a number of features from original-painter
  7827 //       are not yet implemented in detailed painter.
  7828 //       are not yet implemented in detailed painter.
  7828 //       Eg classname, id attributes for icons, labels, tapes
  7829 //       Eg classname, id attributes for icons, labels, tapes
  8507 Timeline.DetailedEventPainter.prototype._fireOnSelect = function(eventID) {
  8508 Timeline.DetailedEventPainter.prototype._fireOnSelect = function(eventID) {
  8508     for (var i = 0; i < this._onSelectListeners.length; i++) {
  8509     for (var i = 0; i < this._onSelectListeners.length; i++) {
  8509         this._onSelectListeners[i](eventID);
  8510         this._onSelectListeners[i](eventID);
  8510     }
  8511     }
  8511 };
  8512 };
  8512 /*==================================================
  8513 /*
  8513  *  Overview Event Painter
  8514  *  Overview Event Painter
  8514  *==================================================
  8515  *
  8515  */
  8516  */
  8516 
  8517 
  8517 Timeline.OverviewEventPainter = function(params) {
  8518 Timeline.OverviewEventPainter = function(params) {
  8518     this._params = params;
  8519     this._params = params;
  8519     this._onSelectListeners = [];
  8520     this._onSelectListeners = [];
  8765 };
  8766 };
  8766 
  8767 
  8767 Timeline.OverviewEventPainter.prototype.showBubble = function(evt) {
  8768 Timeline.OverviewEventPainter.prototype.showBubble = function(evt) {
  8768     // not implemented
  8769     // not implemented
  8769 };
  8770 };
  8770 /*==================================================
  8771 /*
  8771  *  Compact Event Painter
  8772  *  Compact Event Painter
  8772  *==================================================
  8773  *
  8773  */
  8774  */
  8774 
  8775 
  8775 Timeline.CompactEventPainter = function(params) {
  8776 Timeline.CompactEventPainter = function(params) {
  8776     this._params = params;
  8777     this._params = params;
  8777     this._onSelectListeners = [];
  8778     this._onSelectListeners = [];
  9829 Timeline.CompactEventPainter.prototype._fireOnSelect = function(eventIDs) {
  9830 Timeline.CompactEventPainter.prototype._fireOnSelect = function(eventIDs) {
  9830     for (var i = 0; i < this._onSelectListeners.length; i++) {
  9831     for (var i = 0; i < this._onSelectListeners.length; i++) {
  9831         this._onSelectListeners[i](eventIDs);
  9832         this._onSelectListeners[i](eventIDs);
  9832     }
  9833     }
  9833 };
  9834 };
  9834 /*==================================================
  9835 /*
  9835  *  Span Highlight Decorator
  9836  *  Span Highlight Decorator
  9836  *==================================================
  9837  *
  9837  */
  9838  */
  9838 
  9839 
  9839 Timeline.SpanHighlightDecorator = function(params) {
  9840 Timeline.SpanHighlightDecorator = function(params) {
  9840     // When evaluating params, test against null. Not "p in params". Testing against
  9841     // When evaluating params, test against null. Not "p in params". Testing against
  9841     // null enables caller to explicitly request the default. Testing against "in" means
  9842     // null enables caller to explicitly request the default. Testing against "in" means
  9946 };
  9947 };
  9947 
  9948 
  9948 Timeline.SpanHighlightDecorator.prototype.softPaint = function() {
  9949 Timeline.SpanHighlightDecorator.prototype.softPaint = function() {
  9949 };
  9950 };
  9950 
  9951 
  9951 /*==================================================
  9952 /*
  9952  *  Point Highlight Decorator
  9953  *  Point Highlight Decorator
  9953  *==================================================
  9954  *
  9954  */
  9955  */
  9955 
  9956 
  9956 Timeline.PointHighlightDecorator = function(params) {
  9957 Timeline.PointHighlightDecorator = function(params) {
  9957     this._unit = params.unit != null ? params.unit : SimileAjax.NativeDateUnit;
  9958     this._unit = params.unit != null ? params.unit : SimileAjax.NativeDateUnit;
  9958     this._date = (typeof params.date == "string") ?
  9959     this._date = (typeof params.date == "string") ?
 10013     this._layerDiv.style.display = "block";
 10014     this._layerDiv.style.display = "block";
 10014 };
 10015 };
 10015 
 10016 
 10016 Timeline.PointHighlightDecorator.prototype.softPaint = function() {
 10017 Timeline.PointHighlightDecorator.prototype.softPaint = function() {
 10017 };
 10018 };
 10018 /*==================================================
 10019 /*
 10019  *  Default Unit
 10020  *  Default Unit
 10020  *==================================================
 10021  *
 10021  */
 10022  */
 10022 
 10023 
 10023 Timeline.NativeDateUnit = new Object();
 10024 Timeline.NativeDateUnit = new Object();
 10024 
 10025 
 10025 Timeline.NativeDateUnit.createLabeller = function(locale, timeZone) {
 10026 Timeline.NativeDateUnit.createLabeller = function(locale, timeZone) {
 10081 
 10082 
 10082 Timeline.NativeDateUnit.change = function(v, n) {
 10083 Timeline.NativeDateUnit.change = function(v, n) {
 10083     return new Date(v.getTime() + n);
 10084     return new Date(v.getTime() + n);
 10084 };
 10085 };
 10085 
 10086 
 10086 /*==================================================
 10087 /*
 10087  *  Common localization strings
 10088  *  Common localization strings
 10088  *==================================================
 10089  *
 10089  */
 10090  */
 10090 
 10091 
 10091 Timeline.strings["fr"] = {
 10092 Timeline.strings["fr"] = {
 10092     wikiLinkLabel:  "Discute"
 10093     wikiLinkLabel:  "Discute"
 10093 };
 10094 };
 10094 
 10095 
 10095 /*==================================================
 10096 /*
 10096  *  Localization of labellers.js
 10097  *  Localization of labellers.js
 10097  *==================================================
 10098  *
 10098  */
 10099  */
 10099 
 10100 
 10100 Timeline.GregorianDateLabeller.monthNames["fr"] = [
 10101 Timeline.GregorianDateLabeller.monthNames["fr"] = [
 10101     "jan", "fev", "mar", "avr", "mai", "jui", "jui", "aou", "sep", "oct", "nov", "dec"
 10102     "jan", "fev", "mar", "avr", "mai", "jui", "jui", "aou", "sep", "oct", "nov", "dec"
 10102 ];
 10103 ];
 10103 /*==================================================
 10104 /*
 10104  *  Common localization strings
 10105  *  Common localization strings
 10105  *==================================================
 10106  *
 10106  */
 10107  */
 10107 
 10108 
 10108 Timeline.strings["en"] = {
 10109 Timeline.strings["en"] = {
 10109     wikiLinkLabel:  "Discuss"
 10110     wikiLinkLabel:  "Discuss"
 10110 };
 10111 };
 10111 
 10112 
 10112 /*==================================================
 10113 /*
 10113  *  Localization of labellers.js
 10114  *  Localization of labellers.js
 10114  *==================================================
 10115  *
 10115  */
 10116  */
 10116 
 10117 
 10117 Timeline.GregorianDateLabeller.monthNames["en"] = [
 10118 Timeline.GregorianDateLabeller.monthNames["en"] = [
 10118     "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
 10119     "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
 10119 ];
 10120 ];