Browse Source

setup htaccess maintenace page as a 503 static html page

Bachir Soussi Chiadmi 10 years ago
parent
commit
5203118606

+ 3 - 0
.htaccess

@@ -116,6 +116,9 @@ DirectoryIndex index.php index.html index.htm
   RewriteCond %{REQUEST_URI} !=/favicon.ico
   RewriteRule ^ index.php [L]
 
+  RewriteCond %{REMOTE_ADDR} !^82\.230\.62\.145
+  RewriteRule !503 http://www.materio.com/503 [R=503,L]
+
   # Rules to correctly serve gzip compressed CSS and JS files.
   # Requires both mod_rewrite and mod_headers to be enabled.
   <IfModule mod_headers.c>

File diff suppressed because it is too large
+ 7 - 0
503/index.html


+ 20 - 0
503/index_files/colorbox.js

@@ -0,0 +1,20 @@
+(function ($) {
+
+Drupal.behaviors.initColorbox = {
+  attach: function (context, settings) {
+    if (!$.isFunction($.colorbox)) {
+      return;
+    }
+    $('.colorbox', context)
+      .once('init-colorbox')
+      .colorbox(settings.colorbox);
+  }
+};
+
+{
+  $(document).bind('cbox_complete', function () {
+    Drupal.attachBehaviors('#cboxLoadedContent');
+  });
+}
+
+})(jQuery);

+ 56 - 0
503/index_files/colorbox_inline.js

@@ -0,0 +1,56 @@
+(function ($) {
+
+Drupal.behaviors.initColorboxInline = {
+  attach: function (context, settings) {
+    if (!$.isFunction($.colorbox)) {
+      return;
+    }
+    $.urlParam = function(name, url){
+      if (name == 'fragment') {
+        var results = new RegExp('(#[^&#]*)').exec(url);
+      }
+      else {
+        var results = new RegExp('[\\?&]' + name + '=([^&#]*)').exec(url);
+      }
+      if (!results) { return ''; }
+      return results[1] || '';
+    };
+    $('.colorbox-inline', context).once('init-colorbox-inline').colorbox({
+      transition:settings.colorbox.transition,
+      speed:settings.colorbox.speed,
+      opacity:settings.colorbox.opacity,
+      slideshow:settings.colorbox.slideshow,
+      slideshowAuto:settings.colorbox.slideshowAuto,
+      slideshowSpeed:settings.colorbox.slideshowSpeed,
+      slideshowStart:settings.colorbox.slideshowStart,
+      slideshowStop:settings.colorbox.slideshowStop,
+      current:settings.colorbox.current,
+      previous:settings.colorbox.previous,
+      next:settings.colorbox.next,
+      close:settings.colorbox.close,
+      overlayClose:settings.colorbox.overlayClose,
+      maxWidth:settings.colorbox.maxWidth,
+      maxHeight:settings.colorbox.maxHeight,
+      innerWidth:function(){
+        return $.urlParam('width', $(this).attr('href'));
+      },
+      innerHeight:function(){
+        return $.urlParam('height', $(this).attr('href'));
+      },
+      title:function(){
+        return decodeURIComponent($.urlParam('title', $(this).attr('href')));
+      },
+      iframe:function(){
+        return $.urlParam('iframe', $(this).attr('href'));
+      },
+      inline:function(){
+        return $.urlParam('inline', $(this).attr('href'));
+      },
+      href:function(){
+        return $.urlParam('fragment', $(this).attr('href'));
+      }
+    });
+  }
+};
+
+})(jQuery);

+ 42 - 0
503/index_files/colorbox_load.js

@@ -0,0 +1,42 @@
+(function ($) {
+
+Drupal.behaviors.initColorboxLoad = {
+  attach: function (context, settings) {
+    if (!$.isFunction($.colorbox)) {
+      return;
+    }
+    $.urlParams = function (url) {
+      var p = {},
+          e,
+          a = /\+/g,  // Regex for replacing addition symbol with a space
+          r = /([^&=]+)=?([^&]*)/g,
+          d = function (s) { return decodeURIComponent(s.replace(a, ' ')); },
+          q = url.split('?');
+      while (e = r.exec(q[1])) {
+        e[1] = d(e[1]);
+        e[2] = d(e[2]);
+        switch (e[2].toLowerCase()) {
+          case 'true':
+          case 'yes':
+            e[2] = true;
+            break;
+          case 'false':
+          case 'no':
+            e[2] = false;
+            break;
+        }
+        if (e[1] == 'width') { e[1] = 'innerWidth'; }
+        if (e[1] == 'height') { e[1] = 'innerHeight'; }
+        p[e[1]] = e[2];
+      }
+      return p;
+    };
+    $('.colorbox-load', context)
+      .once('init-colorbox-load', function () {
+        var params = $.urlParams($(this).attr('href'));
+        $(this).colorbox($.extend({}, settings.colorbox, params));
+      });
+  }
+};
+
+})(jQuery);

+ 433 - 0
503/index_files/drupal.js

@@ -0,0 +1,433 @@
+
+var Drupal = Drupal || { 'settings': {}, 'behaviors': {}, 'locale': {} };
+
+// Allow other JavaScript libraries to use $.
+jQuery.noConflict();
+
+(function ($) {
+
+/**
+ * Override jQuery.fn.init to guard against XSS attacks.
+ *
+ * See http://bugs.jquery.com/ticket/9521
+ */
+var jquery_init = $.fn.init;
+$.fn.init = function (selector, context, rootjQuery) {
+  // If the string contains a "#" before a "<", treat it as invalid HTML.
+  if (selector && typeof selector === 'string') {
+    var hash_position = selector.indexOf('#');
+    if (hash_position >= 0) {
+      var bracket_position = selector.indexOf('<');
+      if (bracket_position > hash_position) {
+        throw 'Syntax error, unrecognized expression: ' + selector;
+      }
+    }
+  }
+  return jquery_init.call(this, selector, context, rootjQuery);
+};
+$.fn.init.prototype = jquery_init.prototype;
+
+/**
+ * Attach all registered behaviors to a page element.
+ *
+ * Behaviors are event-triggered actions that attach to page elements, enhancing
+ * default non-JavaScript UIs. Behaviors are registered in the Drupal.behaviors
+ * object using the method 'attach' and optionally also 'detach' as follows:
+ * @code
+ *    Drupal.behaviors.behaviorName = {
+ *      attach: function (context, settings) {
+ *        ...
+ *      },
+ *      detach: function (context, settings, trigger) {
+ *        ...
+ *      }
+ *    };
+ * @endcode
+ *
+ * Drupal.attachBehaviors is added below to the jQuery ready event and so
+ * runs on initial page load. Developers implementing AHAH/Ajax in their
+ * solutions should also call this function after new page content has been
+ * loaded, feeding in an element to be processed, in order to attach all
+ * behaviors to the new content.
+ *
+ * Behaviors should use
+ * @code
+ *   $(selector).once('behavior-name', function () {
+ *     ...
+ *   });
+ * @endcode
+ * to ensure the behavior is attached only once to a given element. (Doing so
+ * enables the reprocessing of given elements, which may be needed on occasion
+ * despite the ability to limit behavior attachment to a particular element.)
+ *
+ * @param context
+ *   An element to attach behaviors to. If none is given, the document element
+ *   is used.
+ * @param settings
+ *   An object containing settings for the current context. If none given, the
+ *   global Drupal.settings object is used.
+ */
+Drupal.attachBehaviors = function (context, settings) {
+  context = context || document;
+  settings = settings || Drupal.settings;
+  // Execute all of them.
+  $.each(Drupal.behaviors, function () {
+    if ($.isFunction(this.attach)) {
+      this.attach(context, settings);
+    }
+  });
+};
+
+/**
+ * Detach registered behaviors from a page element.
+ *
+ * Developers implementing AHAH/Ajax in their solutions should call this
+ * function before page content is about to be removed, feeding in an element
+ * to be processed, in order to allow special behaviors to detach from the
+ * content.
+ *
+ * Such implementations should look for the class name that was added in their
+ * corresponding Drupal.behaviors.behaviorName.attach implementation, i.e.
+ * behaviorName-processed, to ensure the behavior is detached only from
+ * previously processed elements.
+ *
+ * @param context
+ *   An element to detach behaviors from. If none is given, the document element
+ *   is used.
+ * @param settings
+ *   An object containing settings for the current context. If none given, the
+ *   global Drupal.settings object is used.
+ * @param trigger
+ *   A string containing what's causing the behaviors to be detached. The
+ *   possible triggers are:
+ *   - unload: (default) The context element is being removed from the DOM.
+ *   - move: The element is about to be moved within the DOM (for example,
+ *     during a tabledrag row swap). After the move is completed,
+ *     Drupal.attachBehaviors() is called, so that the behavior can undo
+ *     whatever it did in response to the move. Many behaviors won't need to
+ *     do anything simply in response to the element being moved, but because
+ *     IFRAME elements reload their "src" when being moved within the DOM,
+ *     behaviors bound to IFRAME elements (like WYSIWYG editors) may need to
+ *     take some action.
+ *   - serialize: When an Ajax form is submitted, this is called with the
+ *     form as the context. This provides every behavior within the form an
+ *     opportunity to ensure that the field elements have correct content
+ *     in them before the form is serialized. The canonical use-case is so
+ *     that WYSIWYG editors can update the hidden textarea to which they are
+ *     bound.
+ *
+ * @see Drupal.attachBehaviors
+ */
+Drupal.detachBehaviors = function (context, settings, trigger) {
+  context = context || document;
+  settings = settings || Drupal.settings;
+  trigger = trigger || 'unload';
+  // Execute all of them.
+  $.each(Drupal.behaviors, function () {
+    if ($.isFunction(this.detach)) {
+      this.detach(context, settings, trigger);
+    }
+  });
+};
+
+/**
+ * Encode special characters in a plain-text string for display as HTML.
+ *
+ * @ingroup sanitization
+ */
+Drupal.checkPlain = function (str) {
+  var character, regex,
+      replace = { '&': '&amp;', '"': '&quot;', '<': '&lt;', '>': '&gt;' };
+  str = String(str);
+  for (character in replace) {
+    if (replace.hasOwnProperty(character)) {
+      regex = new RegExp(character, 'g');
+      str = str.replace(regex, replace[character]);
+    }
+  }
+  return str;
+};
+
+/**
+ * Replace placeholders with sanitized values in a string.
+ *
+ * @param str
+ *   A string with placeholders.
+ * @param args
+ *   An object of replacements pairs to make. Incidences of any key in this
+ *   array are replaced with the corresponding value. Based on the first
+ *   character of the key, the value is escaped and/or themed:
+ *    - !variable: inserted as is
+ *    - @variable: escape plain text to HTML (Drupal.checkPlain)
+ *    - %variable: escape text and theme as a placeholder for user-submitted
+ *      content (checkPlain + Drupal.theme('placeholder'))
+ *
+ * @see Drupal.t()
+ * @ingroup sanitization
+ */
+Drupal.formatString = function(str, args) {
+  // Transform arguments before inserting them.
+  for (var key in args) {
+    switch (key.charAt(0)) {
+      // Escaped only.
+      case '@':
+        args[key] = Drupal.checkPlain(args[key]);
+      break;
+      // Pass-through.
+      case '!':
+        break;
+      // Escaped and placeholder.
+      case '%':
+      default:
+        args[key] = Drupal.theme('placeholder', args[key]);
+        break;
+    }
+    str = str.replace(key, args[key]);
+  }
+  return str;
+};
+
+/**
+ * Translate strings to the page language or a given language.
+ *
+ * See the documentation of the server-side t() function for further details.
+ *
+ * @param str
+ *   A string containing the English string to translate.
+ * @param args
+ *   An object of replacements pairs to make after translation. Incidences
+ *   of any key in this array are replaced with the corresponding value.
+ *   See Drupal.formatString().
+ *
+ * @param options
+ *   - 'context' (defaults to the empty context): The context the source string
+ *     belongs to.
+ *
+ * @return
+ *   The translated string.
+ */
+Drupal.t = function (str, args, options) {
+  options = options || {};
+  options.context = options.context || '';
+
+  // Fetch the localized version of the string.
+  if (Drupal.locale.strings && Drupal.locale.strings[options.context] && Drupal.locale.strings[options.context][str]) {
+    str = Drupal.locale.strings[options.context][str];
+  }
+
+  if (args) {
+    str = Drupal.formatString(str, args);
+  }
+  return str;
+};
+
+/**
+ * Format a string containing a count of items.
+ *
+ * This function ensures that the string is pluralized correctly. Since Drupal.t() is
+ * called by this function, make sure not to pass already-localized strings to it.
+ *
+ * See the documentation of the server-side format_plural() function for further details.
+ *
+ * @param count
+ *   The item count to display.
+ * @param singular
+ *   The string for the singular case. Please make sure it is clear this is
+ *   singular, to ease translation (e.g. use "1 new comment" instead of "1 new").
+ *   Do not use @count in the singular string.
+ * @param plural
+ *   The string for the plural case. Please make sure it is clear this is plural,
+ *   to ease translation. Use @count in place of the item count, as in "@count
+ *   new comments".
+ * @param args
+ *   An object of replacements pairs to make after translation. Incidences
+ *   of any key in this array are replaced with the corresponding value.
+ *   See Drupal.formatString().
+ *   Note that you do not need to include @count in this array.
+ *   This replacement is done automatically for the plural case.
+ * @param options
+ *   The options to pass to the Drupal.t() function.
+ * @return
+ *   A translated string.
+ */
+Drupal.formatPlural = function (count, singular, plural, args, options) {
+  var args = args || {};
+  args['@count'] = count;
+  // Determine the index of the plural form.
+  var index = Drupal.locale.pluralFormula ? Drupal.locale.pluralFormula(args['@count']) : ((args['@count'] == 1) ? 0 : 1);
+
+  if (index == 0) {
+    return Drupal.t(singular, args, options);
+  }
+  else if (index == 1) {
+    return Drupal.t(plural, args, options);
+  }
+  else {
+    args['@count[' + index + ']'] = args['@count'];
+    delete args['@count'];
+    return Drupal.t(plural.replace('@count', '@count[' + index + ']'), args, options);
+  }
+};
+
+/**
+ * Generate the themed representation of a Drupal object.
+ *
+ * All requests for themed output must go through this function. It examines
+ * the request and routes it to the appropriate theme function. If the current
+ * theme does not provide an override function, the generic theme function is
+ * called.
+ *
+ * For example, to retrieve the HTML for text that should be emphasized and
+ * displayed as a placeholder inside a sentence, call
+ * Drupal.theme('placeholder', text).
+ *
+ * @param func
+ *   The name of the theme function to call.
+ * @param ...
+ *   Additional arguments to pass along to the theme function.
+ * @return
+ *   Any data the theme function returns. This could be a plain HTML string,
+ *   but also a complex object.
+ */
+Drupal.theme = function (func) {
+  var args = Array.prototype.slice.apply(arguments, [1]);
+
+  return (Drupal.theme[func] || Drupal.theme.prototype[func]).apply(this, args);
+};
+
+/**
+ * Freeze the current body height (as minimum height). Used to prevent
+ * unnecessary upwards scrolling when doing DOM manipulations.
+ */
+Drupal.freezeHeight = function () {
+  Drupal.unfreezeHeight();
+  $('<div id="freeze-height"></div>').css({
+    position: 'absolute',
+    top: '0px',
+    left: '0px',
+    width: '1px',
+    height: $('body').css('height')
+  }).appendTo('body');
+};
+
+/**
+ * Unfreeze the body height.
+ */
+Drupal.unfreezeHeight = function () {
+  $('#freeze-height').remove();
+};
+
+/**
+ * Encodes a Drupal path for use in a URL.
+ *
+ * For aesthetic reasons slashes are not escaped.
+ */
+Drupal.encodePath = function (item, uri) {
+  uri = uri || location.href;
+  return encodeURIComponent(item).replace(/%2F/g, '/');
+};
+
+/**
+ * Get the text selection in a textarea.
+ */
+Drupal.getSelection = function (element) {
+  if (typeof element.selectionStart != 'number' && document.selection) {
+    // The current selection.
+    var range1 = document.selection.createRange();
+    var range2 = range1.duplicate();
+    // Select all text.
+    range2.moveToElementText(element);
+    // Now move 'dummy' end point to end point of original range.
+    range2.setEndPoint('EndToEnd', range1);
+    // Now we can calculate start and end points.
+    var start = range2.text.length - range1.text.length;
+    var end = start + range1.text.length;
+    return { 'start': start, 'end': end };
+  }
+  return { 'start': element.selectionStart, 'end': element.selectionEnd };
+};
+
+/**
+ * Build an error message from an Ajax response.
+ */
+Drupal.ajaxError = function (xmlhttp, uri) {
+  var statusCode, statusText, pathText, responseText, readyStateText, message;
+  if (xmlhttp.status) {
+    statusCode = "\n" + Drupal.t("An AJAX HTTP error occurred.") +  "\n" + Drupal.t("HTTP Result Code: !status", {'!status': xmlhttp.status});
+  }
+  else {
+    statusCode = "\n" + Drupal.t("An AJAX HTTP request terminated abnormally.");
+  }
+  statusCode += "\n" + Drupal.t("Debugging information follows.");
+  pathText = "\n" + Drupal.t("Path: !uri", {'!uri': uri} );
+  statusText = '';
+  // In some cases, when statusCode == 0, xmlhttp.statusText may not be defined.
+  // Unfortunately, testing for it with typeof, etc, doesn't seem to catch that
+  // and the test causes an exception. So we need to catch the exception here.
+  try {
+    statusText = "\n" + Drupal.t("StatusText: !statusText", {'!statusText': $.trim(xmlhttp.statusText)});
+  }
+  catch (e) {}
+
+  responseText = '';
+  // Again, we don't have a way to know for sure whether accessing
+  // xmlhttp.responseText is going to throw an exception. So we'll catch it.
+  try {
+    responseText = "\n" + Drupal.t("ResponseText: !responseText", {'!responseText': $.trim(xmlhttp.responseText) } );
+  } catch (e) {}
+
+  // Make the responseText more readable by stripping HTML tags and newlines.
+  responseText = responseText.replace(/<("[^"]*"|'[^']*'|[^'">])*>/gi,"");
+  responseText = responseText.replace(/[\n]+\s+/g,"\n");
+
+  // We don't need readyState except for status == 0.
+  readyStateText = xmlhttp.status == 0 ? ("\n" + Drupal.t("ReadyState: !readyState", {'!readyState': xmlhttp.readyState})) : "";
+
+  message = statusCode + pathText + statusText + responseText + readyStateText;
+  return message;
+};
+
+// Class indicating that JS is enabled; used for styling purpose.
+$('html').addClass('js');
+
+// 'js enabled' cookie.
+document.cookie = 'has_js=1; path=/';
+
+/**
+ * Additions to jQuery.support.
+ */
+$(function () {
+  /**
+   * Boolean indicating whether or not position:fixed is supported.
+   */
+  if (jQuery.support.positionFixed === undefined) {
+    var el = $('<div style="position:fixed; top:10px" />').appendTo(document.body);
+    jQuery.support.positionFixed = el[0].offsetTop === 10;
+    el.remove();
+  }
+});
+
+//Attach all behaviors.
+$(function () {
+  Drupal.attachBehaviors(document, Drupal.settings);
+});
+
+/**
+ * The default themes.
+ */
+Drupal.theme.prototype = {
+
+  /**
+   * Formats text for emphasized display in a placeholder inside a sentence.
+   *
+   * @param str
+   *   The text to format (plain-text).
+   * @return
+   *   The formatted text (html).
+   */
+  placeholder: function (str) {
+    return '<em class="placeholder">' + Drupal.checkPlain(str) + '</em>';
+  }
+};
+
+})(jQuery);

+ 106 - 0
503/index_files/extlink.js

@@ -0,0 +1,106 @@
+// $Id: extlink.js,v 1.8 2010/05/26 01:25:56 quicksketch Exp $
+(function ($) {
+
+function extlinkAttach(context) {
+  // Strip the host name down, removing ports, subdomains, or www.
+  var pattern = /^(([^\/:]+?\.)*)([^\.:]{4,})((\.[a-z]{1,4})*)(:[0-9]{1,5})?$/;
+  var host = window.location.host.replace(pattern, '$3$4');
+  var subdomain = window.location.host.replace(pattern, '$1');
+
+  // Determine what subdomains are considered internal.
+  if (Drupal.settings.extlink.extSubdomains) {
+    var subdomains = "([^/]*\\.)?";
+  }
+  else if (subdomain == 'www.' || subdomain == '') {
+    var subdomains = "(www\\.)?";
+  }
+  else {
+    var subdomains = subdomain.replace(".", "\\.");
+  }
+
+  // Build regular expressions that define an internal link.
+  var internal_link = new RegExp("^https?://" + subdomains + host, "i");
+
+  // Extra internal link matching.
+  var extInclude = false;
+  if (Drupal.settings.extlink.extInclude) {
+    extInclude = new RegExp(Drupal.settings.extlink.extInclude.replace(/\\/, '\\'));
+  }
+
+  // Extra external link matching.
+  var extExclude = false;
+  if (Drupal.settings.extlink.extExclude) {
+    extExclude = new RegExp(Drupal.settings.extlink.extExclude.replace(/\\/, '\\'));
+  }
+
+  // Find all links which are NOT internal and begin with http (as opposed
+  // to ftp://, javascript:, etc. other kinds of links.
+  // When operating on the 'this' variable, the host has been appended to
+  // all links by the browser, even local ones.
+  // In jQuery 1.1 and higher, we'd use a filter method here, but it is not
+  // available in jQuery 1.0 (Drupal 5 default).
+  var external_links = new Array();
+  var mailto_links = new Array();
+  $("a:not(." + Drupal.settings.extlink.extClass + ", ." + Drupal.settings.extlink.mailtoClass + ")", context).each(function(el) {
+    try {
+      var url = this.href.toLowerCase();
+      if (url.indexOf('http') == 0 && (!url.match(internal_link) || (extInclude && url.match(extInclude))) && !(extExclude && url.match(extExclude))) {
+        external_links.push(this);
+      }
+      else if (url.indexOf('mailto:') == 0) {
+        mailto_links.push(this);
+      }
+    }
+    // IE7 throws errors often when dealing with irregular links, such as:
+    // <a href="node/10"></a> Empty tags.
+    // <a href="http://user:pass@example.com">example</a> User:pass syntax.
+    catch(error) {
+      return false;
+    }
+  });
+
+  if (Drupal.settings.extlink.extClass) {
+    // Apply the "ext" class to all links not containing images.
+    if (parseFloat($().jquery) < 1.2) {
+      $(external_links).not('[img]').addClass(Drupal.settings.extlink.extClass).each(function() { if ($(this).css('display') == 'inline') $(this).after('<span class=' + Drupal.settings.extlink.extClass + '></span>'); });
+    }
+    else {
+      $(external_links).not($(external_links).find('img').parents('a')).addClass(Drupal.settings.extlink.extClass).each(function() { if ($(this).css('display') == 'inline') $(this).after('<span class=' + Drupal.settings.extlink.extClass + '></span>'); });
+    }
+  }
+
+  if (Drupal.settings.extlink.mailtoClass) {
+    // Apply the "mailto" class to all mailto links not containing images.
+    if (parseFloat($().jquery) < 1.2) {
+      $(mailto_links).not('[img]').addClass(Drupal.settings.extlink.mailtoClass).each(function() { if ($(this).css('display') == 'inline') $(this).after('<span class=' + Drupal.settings.extlink.mailtoClass + '></span>'); });
+    }
+    else {
+      $(mailto_links).not($(mailto_links).find('img').parents('a')).addClass(Drupal.settings.extlink.mailtoClass).each(function() { if ($(this).css('display') == 'inline') $(this).after('<span class=' + Drupal.settings.extlink.mailtoClass + '></span>'); });
+    }
+  }
+
+  if (Drupal.settings.extlink.extTarget) {
+    // Apply the target attribute to all links.
+    $(external_links).attr('target', Drupal.settings.extlink.extTarget);
+  }
+
+  if (Drupal.settings.extlink.extAlert) {
+    // Add pop-up click-through dialog.
+    $(external_links).click(function(e) {
+     return confirm(Drupal.settings.extlink.extAlertText);
+    });
+  }
+
+  // Work around for Internet Explorer box model problems.
+  if (($.support && !($.support.boxModel === undefined) && !$.support.boxModel) || ($.browser.msie && parseInt($.browser.version) <= 7)) {
+    $('span.ext, span.mailto').css('display', 'inline-block');
+  }
+}
+
+Drupal.behaviors.extlink = {
+  attach: function(context){
+    extlinkAttach(context);
+  }
+}
+
+})(jQuery);

File diff suppressed because it is too large
+ 16 - 0
503/index_files/jquery.js


+ 610 - 0
503/index_files/jquery_002.js

@@ -0,0 +1,610 @@
+// version 1.6.0
+// http://welcome.totheinter.net/columnizer-jquery-plugin/
+// created by: Adam Wulf @adamwulf, adam.wulf@gmail.com
+
+(function($){
+
+ $.fn.columnize = function(options) {
+
+
+	var defaults = {
+		// default width of columns
+		width: 400,
+		// optional # of columns instead of width
+		columns : false,
+		// true to build columns once regardless of window resize
+		// false to rebuild when content box changes bounds
+		buildOnce : false,
+		// an object with options if the text should overflow
+		// it's container if it can't fit within a specified height
+		overflow : false,
+		// this function is called after content is columnized
+		doneFunc : function(){},
+		// if the content should be columnized into a 
+		// container node other than it's own node
+		target : false,
+		// re-columnizing when images reload might make things
+		// run slow. so flip this to true if it's causing delays
+		ignoreImageLoading : true,
+		// should columns float left or right
+		columnFloat : "left",
+		// ensure the last column is never the tallest column
+		lastNeverTallest : false,
+		// (int) the minimum number of characters to jump when splitting
+		// text nodes. smaller numbers will result in higher accuracy
+		// column widths, but will take slightly longer
+		accuracy : false,
+		// don't automatically layout columns, only use manual columnbreak
+		manualBreaks : false,
+		// previx for all the CSS classes used by this plugin
+		// default to empty string for backwards compatibility
+		cssClassPrefix : ""
+	};
+	var options = $.extend(defaults, options);
+	
+	if(typeof(options.width) == "string"){
+		options.width = parseInt(options.width);
+		if(isNaN(options.width)){
+			options.width = defaults.width;
+		}
+	}
+
+    return this.each(function() {
+	    var $inBox = options.target ? $(options.target) : $(this);
+		var maxHeight = $(this).height();
+		var $cache = $('<div></div>'); // this is where we'll put the real content
+		var lastWidth = 0;
+		var columnizing = false;
+		var manualBreaks = options.manualBreaks;
+		var cssClassPrefix = defaults.cssClassPrefix;
+		if(typeof(options.cssClassPrefix) == "string"){
+			cssClassPrefix = options.cssClassPrefix;
+		}
+
+		
+		var adjustment = 0;
+		
+		$cache.append($(this).contents().clone(true));
+	    
+	    // images loading after dom load
+	    // can screw up the column heights,
+	    // so recolumnize after images load
+	    if(!options.ignoreImageLoading && !options.target){
+	    	if(!$inBox.data("imageLoaded")){
+		    	$inBox.data("imageLoaded", true);
+		    	if($(this).find("img").length > 0){
+		    		// only bother if there are
+		    		// actually images...
+			    	var func = function($inBox,$cache){ return function(){
+				    	if(!$inBox.data("firstImageLoaded")){
+				    		$inBox.data("firstImageLoaded", "true");
+					    	$inBox.empty().append($cache.children().clone(true));
+					    	$inBox.columnize(options);
+				    	}
+			    	}}($(this), $cache);
+				    $(this).find("img").one("load", func);
+				    $(this).find("img").one("abort", func);
+				    return;
+		    	}
+	    	}
+	    }
+	    
+		$inBox.empty();
+		
+		columnizeIt();
+		
+		if(!options.buildOnce){
+			$(window).resize(function() {
+				if(!options.buildOnce && $.browser.msie){
+					if($inBox.data("timeout")){
+						clearTimeout($inBox.data("timeout"));
+					}
+					$inBox.data("timeout", setTimeout(columnizeIt, 200));
+				}else if(!options.buildOnce){
+					columnizeIt();
+				}else{
+					// don't rebuild
+				}
+			});
+		}
+		
+		function prefixTheClassName(className, withDot){
+			var dot = withDot ? "." : "";
+			if(cssClassPrefix.length){
+				return dot + cssClassPrefix + "-" + className;
+			}
+			return dot + className;
+		}
+		
+         
+		/**
+		 * this fuction builds as much of a column as it can without
+		 * splitting nodes in half. If the last node in the new column
+		 * is a text node, then it will try to split that text node. otherwise
+		 * it will leave the node in $pullOutHere and return with a height
+		 * smaller than targetHeight.
+		 * 
+         * Returns a boolean on whether we did some splitting successfully at a text point
+         * (so we know we don't need to split a real element). return false if the caller should
+         * split a node if possible to end this column.
+		 *
+		 * @param putInHere, the jquery node to put elements into for the current column
+		 * @param $pullOutHere, the jquery node to pull elements out of (uncolumnized html)
+		 * @param $parentColumn, the jquery node for the currently column that's being added to
+		 * @param targetHeight, the ideal height for the column, get as close as we can to this height
+		 */
+		function columnize($putInHere, $pullOutHere, $parentColumn, targetHeight){
+			//
+			// add as many nodes to the column as we can,
+			// but stop once our height is too tall
+			while((manualBreaks || $parentColumn.height() < targetHeight) &&
+				  $pullOutHere[0].childNodes.length){
+				var node = $pullOutHere[0].childNodes[0]
+				//
+				// Because we're not cloning, jquery will actually move the element"
+				// http://welcome.totheinter.net/2009/03/19/the-undocumented-life-of-jquerys-append/
+				if($(node).find(prefixTheClassName("columnbreak", true)).length){
+					//
+					// our column is on a column break, so just end here
+					return;
+				}
+				if($(node).hasClass(prefixTheClassName("columnbreak"))){
+					//
+					// our column is on a column break, so just end here
+					return;
+				}
+				$putInHere.append(node);
+			}
+			if($putInHere[0].childNodes.length == 0) return;
+			
+			// now we're too tall, so undo the last one
+			var kids = $putInHere[0].childNodes;
+			var lastKid = kids[kids.length-1];
+			$putInHere[0].removeChild(lastKid);
+			var $item = $(lastKid);
+			
+			//
+			// now lets try to split that last node
+			// to fit as much of it as we can into this column
+			if($item[0].nodeType == 3){
+				// it's a text node, split it up
+				var oText = $item[0].nodeValue;
+				var counter2 = options.width / 18;
+				if(options.accuracy)
+				counter2 = options.accuracy;
+				var columnText;
+				var latestTextNode = null;
+				while($parentColumn.height() < targetHeight && oText.length){
+					var indexOfSpace = oText.indexOf(' ', counter2);
+					if (indexOfSpace != -1) {
+						columnText = oText.substring(0, oText.indexOf(' ', counter2));
+					} else {
+						columnText = oText;
+					}
+					latestTextNode = document.createTextNode(columnText);
+					$putInHere.append(latestTextNode);
+					
+					if(oText.length > counter2 && indexOfSpace != -1){
+						oText = oText.substring(indexOfSpace);
+					}else{
+						oText = "";
+					}
+				}
+				if($parentColumn.height() >= targetHeight && latestTextNode != null){
+					// too tall :(
+					$putInHere[0].removeChild(latestTextNode);
+					oText = latestTextNode.nodeValue + oText;
+				}
+				if(oText.length){
+					$item[0].nodeValue = oText;
+				}else{
+					return false; // we ate the whole text node, move on to the next node
+				}
+			}
+			
+			if($pullOutHere.contents().length){
+				$pullOutHere.prepend($item);
+			}else{
+				$pullOutHere.append($item);
+			}
+			
+			return $item[0].nodeType == 3;
+		}
+		
+		/**
+		 * Split up an element, which is more complex than splitting text. We need to create 
+		 * two copies of the element with it's contents divided between each
+		 */
+		function split($putInHere, $pullOutHere, $parentColumn, targetHeight){
+			if($putInHere.contents(":last").find(prefixTheClassName("columnbreak", true)).length){
+				//
+				// our column is on a column break, so just end here
+				return;
+			}
+			if($putInHere.contents(":last").hasClass(prefixTheClassName("columnbreak"))){
+				//
+				// our column is on a column break, so just end here
+				return;
+			}
+			if($pullOutHere.contents().length){
+				var $cloneMe = $pullOutHere.contents(":first");
+				//
+				// make sure we're splitting an element
+				if($cloneMe.get(0).nodeType != 1) return;
+				
+				//
+				// clone the node with all data and events
+				var $clone = $cloneMe.clone(true);
+				//
+				// need to support both .prop and .attr if .prop doesn't exist.
+				// this is for backwards compatibility with older versions of jquery.
+				if($cloneMe.hasClass(prefixTheClassName("columnbreak"))){
+					//
+					// ok, we have a columnbreak, so add it into
+					// the column and exit
+					$putInHere.append($clone);
+					$cloneMe.remove();
+				}else if (manualBreaks){
+					// keep adding until we hit a manual break
+					$putInHere.append($clone);
+					$cloneMe.remove();
+				}else if($clone.get(0).nodeType == 1 && !$clone.hasClass(prefixTheClassName("dontend"))){ 
+					$putInHere.append($clone);
+					if($clone.is("img") && $parentColumn.height() < targetHeight + 20){
+						//
+						// we can't split an img in half, so just add it
+						// to the column and remove it from the pullOutHere section
+						$cloneMe.remove();
+					}else if(!$cloneMe.hasClass(prefixTheClassName("dontsplit")) && $parentColumn.height() < targetHeight + 20){
+						//
+						// pretty close fit, and we're not allowed to split it, so just
+						// add it to the column, remove from pullOutHere, and be done
+						$cloneMe.remove();
+					}else if($clone.is("img") || $cloneMe.hasClass(prefixTheClassName("dontsplit"))){
+						//
+						// it's either an image that's too tall, or an unsplittable node
+						// that's too tall. leave it in the pullOutHere and we'll add it to the 
+						// next column
+						$clone.remove();
+					}else{
+						//
+						// ok, we're allowed to split the node in half, so empty out
+						// the node in the column we're building, and start splitting
+						// it in half, leaving some of it in pullOutHere
+						$clone.empty();
+						if(!columnize($clone, $cloneMe, $parentColumn, targetHeight)){
+							// this node still has non-text nodes to split
+							// add the split class and then recur
+							$cloneMe.addClass(prefixTheClassName("split"));
+							if($cloneMe.children().length){
+								split($clone, $cloneMe, $parentColumn, targetHeight);
+							}
+						}else{
+							// this node only has text node children left, add the
+							// split class and move on.
+							$cloneMe.addClass(prefixTheClassName("split"));
+						}
+						if($clone.get(0).childNodes.length == 0){
+							// it was split, but nothing is in it :(
+							$clone.remove();
+						}
+					}
+				}
+			}
+		}
+		
+		
+		function singleColumnizeIt() {
+			if ($inBox.data("columnized") && $inBox.children().length == 1) {
+				return;
+			}
+			$inBox.data("columnized", true);
+			$inBox.data("columnizing", true);
+			
+			$inBox.empty();
+			$inBox.append($("<div class='"
+			 + prefixTheClassName("first") + " "
+			 + prefixTheClassName("last") + " "
+			 + prefixTheClassName("column") + " "
+			 + "' style='width:100%; float: " + options.columnFloat + ";'></div>")); //"
+			$col = $inBox.children().eq($inBox.children().length-1);
+			$destroyable = $cache.clone(true);
+			if(options.overflow){
+				targetHeight = options.overflow.height;
+				columnize($col, $destroyable, $col, targetHeight);
+				// make sure that the last item in the column isn't a "dontend"
+				if(!$destroyable.contents().find(":first-child").hasClass(prefixTheClassName("dontend"))){
+					split($col, $destroyable, $col, targetHeight);
+				}
+				
+				while($col.contents(":last").length && checkDontEndColumn($col.contents(":last").get(0))){
+					var $lastKid = $col.contents(":last");
+					$lastKid.remove();
+					$destroyable.prepend($lastKid);
+				}
+
+				var html = "";
+				var div = document.createElement('DIV');
+				while($destroyable[0].childNodes.length > 0){
+					var kid = $destroyable[0].childNodes[0];
+					if(kid.attributes){
+						for(var i=0;i<kid.attributes.length;i++){
+							if(kid.attributes[i].nodeName.indexOf("jQuery") == 0){
+								kid.removeAttribute(kid.attributes[i].nodeName);
+							}
+						}
+					}
+					div.innerHTML = "";
+					div.appendChild($destroyable[0].childNodes[0]);
+					html += div.innerHTML;
+				}
+				var overflow = $(options.overflow.id)[0];
+				overflow.innerHTML = html;
+
+			}else{
+				$col.append($destroyable);
+			}
+			$inBox.data("columnizing", false);
+			
+			if(options.overflow && options.overflow.doneFunc){
+				options.overflow.doneFunc();
+			}
+			
+		}
+		
+		/**
+		 * returns true if the input dom node
+		 * should not end a column.
+		 * returns false otherwise
+		 */
+		function checkDontEndColumn(dom){
+			if(dom.nodeType == 3){
+				// text node. ensure that the text
+				// is not 100% whitespace
+				if(/^\s+$/.test(dom.nodeValue)){
+						//
+				        // ok, it's 100% whitespace,
+				        // so we should return checkDontEndColumn
+				        // of the inputs previousSibling
+				        if(!dom.previousSibling) return false;
+					return checkDontEndColumn(dom.previousSibling);
+				}
+				return false;
+			}
+			if(dom.nodeType != 1) return false;
+			if($(dom).hasClass(prefixTheClassName("dontend"))) return true;
+			if(dom.childNodes.length == 0) return false;
+			return checkDontEndColumn(dom.childNodes[dom.childNodes.length-1]);
+		}
+		
+		
+		
+		function columnizeIt() {
+			//reset adjustment var
+			adjustment = 0;
+			if(lastWidth == $inBox.width()) return;
+			lastWidth = $inBox.width();
+			
+			var numCols = Math.round($inBox.width() / options.width);
+			var optionWidth = options.width;
+			var optionHeight = options.height;
+			if(options.columns) numCols = options.columns;
+			if(manualBreaks){
+				numCols = $cache.find(prefixTheClassName("columnbreak", true)).length + 1;
+				optionWidth = false;
+			}
+			
+//			if ($inBox.data("columnized") && numCols == $inBox.children().length) {
+//				return;
+//			}
+			if(numCols <= 1){
+				return singleColumnizeIt();
+			}
+			if($inBox.data("columnizing")) return;
+			$inBox.data("columnized", true);
+			$inBox.data("columnizing", true);
+			
+			$inBox.empty();
+			$inBox.append($("<div style='width:" + (Math.floor(100 / numCols))+ "%; float: " + options.columnFloat + ";'></div>")); //"
+			$col = $inBox.children(":last");
+			$col.append($cache.clone());
+			maxHeight = $col.height();
+			$inBox.empty();
+			
+			var targetHeight = maxHeight / numCols;
+			var firstTime = true;
+			var maxLoops = 3;
+			var scrollHorizontally = false;
+			if(options.overflow){
+				maxLoops = 1;
+				targetHeight = options.overflow.height;
+			}else if(optionHeight && optionWidth){
+				maxLoops = 1;
+				targetHeight = optionHeight;
+				scrollHorizontally = true;
+			}
+			
+			//
+			// We loop as we try and workout a good height to use. We know it initially as an average 
+			// but if the last column is higher than the first ones (which can happen, depending on split
+			// points) we need to raise 'adjustment'. We try this over a few iterations until we're 'solid'.
+			//
+			// also, lets hard code the max loops to 20. that's /a lot/ of loops for columnizer,
+			// and should keep run aways in check. if somehow someone has content combined with
+			// options that would cause an infinite loop, then this'll definitely stop it.
+			for(var loopCount=0;loopCount<maxLoops && maxLoops < 20;loopCount++){
+				$inBox.empty();
+				var $destroyable;
+				try{
+					$destroyable = $cache.clone(true);
+				}catch(e){
+					// jquery in ie6 can't clone with true
+					$destroyable = $cache.clone();
+				}
+				$destroyable.css("visibility", "hidden");
+				// create the columns
+				for (var i = 0; i < numCols; i++) {
+					/* create column */
+					var className = (i == 0) ? prefixTheClassName("first") : "";
+					className += " " + prefixTheClassName("column");
+					var className = (i == numCols - 1) ? (prefixTheClassName("last") + " " + className) : className;
+					$inBox.append($("<div class='" + className + "' style='width:" + (Math.floor(100 / numCols))+ "%; float: " + options.columnFloat + ";'></div>")); //"
+				}
+				
+				// fill all but the last column (unless overflowing)
+				var i = 0;
+				while(i < numCols - (options.overflow ? 0 : 1) || scrollHorizontally && $destroyable.contents().length){
+					if($inBox.children().length <= i){
+						// we ran out of columns, make another
+						$inBox.append($("<div class='" + className + "' style='width:" + (Math.floor(100 / numCols))+ "%; float: " + options.columnFloat + ";'></div>")); //"
+					}
+					var $col = $inBox.children().eq(i);
+					columnize($col, $destroyable, $col, targetHeight);
+					// make sure that the last item in the column isn't a "dontend"
+					split($col, $destroyable, $col, targetHeight);
+					
+					while($col.contents(":last").length && checkDontEndColumn($col.contents(":last").get(0))){
+						var $lastKid = $col.contents(":last");
+						$lastKid.remove();
+						$destroyable.prepend($lastKid);
+					}
+					i++;
+					
+					//
+					// https://github.com/adamwulf/Columnizer-jQuery-Plugin/issues/47
+					//
+					// check for infinite loop.
+					//
+					// this could happen when a dontsplit or dontend item is taller than the column
+					// we're trying to build, and its never actually added to a column.
+					//
+					// this results in empty columns being added with the dontsplit item
+					// perpetually waiting to get put into a column. lets force the issue here
+					if($col.contents().length == 0 && $destroyable.contents().length){
+						//
+						// ok, we're building zero content columns. this'll happen forever
+						// since nothing can ever get taken out of destroyable.
+						//
+						// to fix, lets put 1 item from destroyable into the empty column
+						// before we iterate
+						$col.append($destroyable.contents(":first"));
+					}else if(i == numCols - (options.overflow ? 0 : 1) && !options.overflow){
+						//
+						// ok, we're about to exit the while loop because we're done with all
+						// columns except the last column.
+						//
+						// if $destroyable still has columnbreak nodes in it, then we need to keep
+						// looping and creating more columns.
+						if($destroyable.find(prefixTheClassName("columnbreak", true)).length){
+							numCols ++;
+						}
+					}
+					
+				}
+				if(options.overflow && !scrollHorizontally){
+					var IE6 = false /*@cc_on || @_jscript_version < 5.7 @*/;
+					var IE7 = (document.all) && (navigator.appVersion.indexOf("MSIE 7.") != -1);
+					if(IE6 || IE7){
+						var html = "";
+						var div = document.createElement('DIV');
+						while($destroyable[0].childNodes.length > 0){
+							var kid = $destroyable[0].childNodes[0];
+							for(var i=0;i<kid.attributes.length;i++){
+								if(kid.attributes[i].nodeName.indexOf("jQuery") == 0){
+									kid.removeAttribute(kid.attributes[i].nodeName);
+								}
+							}
+							div.innerHTML = "";
+							div.appendChild($destroyable[0].childNodes[0]);
+							html += div.innerHTML;
+						}
+						var overflow = $(options.overflow.id)[0];
+						overflow.innerHTML = html;
+					}else{
+						$(options.overflow.id).empty().append($destroyable.contents().clone(true));
+					}
+				}else if(!scrollHorizontally){
+					// the last column in the series
+					$col = $inBox.children().eq($inBox.children().length-1);
+					while($destroyable.contents().length) $col.append($destroyable.contents(":first"));
+					var afterH = $col.height();
+					var diff = afterH - targetHeight;
+					var totalH = 0;
+					var min = 10000000;
+					var max = 0;
+					var lastIsMax = false;
+					var numberOfColumnsThatDontEndInAColumnBreak = 0;
+					$inBox.children().each(function($inBox){ return function($item){
+						var $col = $inBox.children().eq($item);
+						var endsInBreak = $col.children(":last").find(prefixTheClassName("columnbreak", true)).length;
+						if(!endsInBreak){
+							var h = $col.height();
+							lastIsMax = false;
+							totalH += h;
+							if(h > max) {
+								max = h;
+								lastIsMax = true;
+							}
+							if(h < min) min = h;
+							numberOfColumnsThatDontEndInAColumnBreak++;
+						}
+					}}($inBox));
+
+					var avgH = totalH / numberOfColumnsThatDontEndInAColumnBreak;
+					if(totalH == 0){
+						//
+						// all columns end in a column break,
+						// so we're done here
+						loopCount = maxLoops;
+					}else if(options.lastNeverTallest && lastIsMax){
+						// the last column is the tallest
+						// so allow columns to be taller
+						// and retry
+						//
+						// hopefully this'll mean more content fits into
+						// earlier columns, so that the last column
+						// can be shorter than the rest
+						adjustment += 30;
+
+						targetHeight = targetHeight + 30;
+						if(loopCount == maxLoops-1) maxLoops++;
+					}else if(max - min > 30){
+						// too much variation, try again
+						targetHeight = avgH + 30;
+					}else if(Math.abs(avgH-targetHeight) > 20){
+						// too much variation, try again
+						targetHeight = avgH;
+					}else {
+						// solid, we're done
+						loopCount = maxLoops;
+					}
+				}else{
+					// it's scrolling horizontally, fix the width/classes of the columns
+					$inBox.children().each(function(i){
+						$col = $inBox.children().eq(i);
+						$col.width(optionWidth + "px");
+						if(i==0){
+							$col.addClass(prefixTheClassName("first"));
+						}else if(i==$inBox.children().length-1){
+							$col.addClass(prefixTheClassName("last"));
+						}else{
+							$col.removeClass(prefixTheClassName("first"));
+							$col.removeClass(prefixTheClassName("last"));
+						}
+					});
+					$inBox.width($inBox.children().length * optionWidth + "px");
+				}
+				$inBox.append($("<br style='clear:both;'>"));
+			}
+			$inBox.find(prefixTheClassName("column", true)).find(":first" + prefixTheClassName("removeiffirst", true)).remove();
+			$inBox.find(prefixTheClassName("column", true)).find(':last' + prefixTheClassName("removeiflast", true)).remove();
+			$inBox.data("columnizing", false);
+
+			if(options.overflow){
+				options.overflow.doneFunc();
+			}
+			options.doneFunc();
+		}
+    });
+ };
+})(jQuery);

File diff suppressed because it is too large
+ 14 - 0
503/index_files/jquery_003.js


+ 79 - 0
503/index_files/jquery_004.js

@@ -0,0 +1,79 @@
+
+/**
+ * jQuery Once Plugin v1.2
+ * http://plugins.jquery.com/project/once
+ *
+ * Dual licensed under the MIT and GPL licenses:
+ *   http://www.opensource.org/licenses/mit-license.php
+ *   http://www.gnu.org/licenses/gpl.html
+ */
+
+(function ($) {
+  var cache = {}, uuid = 0;
+
+  /**
+   * Filters elements by whether they have not yet been processed.
+   *
+   * @param id
+   *   (Optional) If this is a string, then it will be used as the CSS class
+   *   name that is applied to the elements for determining whether it has
+   *   already been processed. The elements will get a class in the form of
+   *   "id-processed".
+   *
+   *   If the id parameter is a function, it will be passed off to the fn
+   *   parameter and the id will become a unique identifier, represented as a
+   *   number.
+   *
+   *   When the id is neither a string or a function, it becomes a unique
+   *   identifier, depicted as a number. The element's class will then be
+   *   represented in the form of "jquery-once-#-processed".
+   *
+   *   Take note that the id must be valid for usage as an element's class name.
+   * @param fn
+   *   (Optional) If given, this function will be called for each element that
+   *   has not yet been processed. The function's return value follows the same
+   *   logic as $.each(). Returning true will continue to the next matched
+   *   element in the set, while returning false will entirely break the
+   *   iteration.
+   */
+  $.fn.once = function (id, fn) {
+    if (typeof id != 'string') {
+      // Generate a numeric ID if the id passed can't be used as a CSS class.
+      if (!(id in cache)) {
+        cache[id] = ++uuid;
+      }
+      // When the fn parameter is not passed, we interpret it from the id.
+      if (!fn) {
+        fn = id;
+      }
+      id = 'jquery-once-' + cache[id];
+    }
+    // Remove elements from the set that have already been processed.
+    var name = id + '-processed';
+    var elements = this.not('.' + name).addClass(name);
+
+    return $.isFunction(fn) ? elements.each(fn) : elements;
+  };
+
+  /**
+   * Filters elements that have been processed once already.
+   *
+   * @param id
+   *   A required string representing the name of the class which should be used
+   *   when filtering the elements. This only filters elements that have already
+   *   been processed by the once function. The id should be the same id that
+   *   was originally passed to the once() function.
+   * @param fn
+   *   (Optional) If given, this function will be called for each element that
+   *   has not yet been processed. The function's return value follows the same
+   *   logic as $.each(). Returning true will continue to the next matched
+   *   element in the set, while returning false will entirely break the
+   *   iteration.
+   */
+  $.fn.removeOnce = function (id, fn) {
+    var name = id + '-processed';
+    var elements = this.filter('.' + name).removeClass(name);
+
+    return $.isFunction(fn) ? elements.each(fn) : elements;
+  };
+})(jQuery);

File diff suppressed because it is too large
+ 5 - 0
503/index_files/jquery_005.js


File diff suppressed because it is too large
+ 0 - 0
503/index_files/jquery_006.js


+ 99 - 0
503/index_files/jquery_007.js

@@ -0,0 +1,99 @@
+/*
+ * jQuery Hotkeys Plugin
+ * Copyright 2010, John Resig
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ *
+ * Based upon the plugin by Tzury Bar Yochay:
+ * http://github.com/tzuryby/hotkeys
+ *
+ * Original idea by:
+ * Binny V A, http://www.openjs.com/scripts/events/keyboard_shortcuts/
+*/
+
+(function(jQuery){
+	
+	jQuery.hotkeys = {
+		version: "0.8",
+
+		specialKeys: {
+			8: "backspace", 9: "tab", 13: "return", 16: "shift", 17: "ctrl", 18: "alt", 19: "pause",
+			20: "capslock", 27: "esc", 32: "space", 33: "pageup", 34: "pagedown", 35: "end", 36: "home",
+			37: "left", 38: "up", 39: "right", 40: "down", 45: "insert", 46: "del", 
+			96: "0", 97: "1", 98: "2", 99: "3", 100: "4", 101: "5", 102: "6", 103: "7",
+			104: "8", 105: "9", 106: "*", 107: "+", 109: "-", 110: ".", 111 : "/", 
+			112: "f1", 113: "f2", 114: "f3", 115: "f4", 116: "f5", 117: "f6", 118: "f7", 119: "f8", 
+			120: "f9", 121: "f10", 122: "f11", 123: "f12", 144: "numlock", 145: "scroll", 191: "/", 224: "meta"
+		},
+	
+		shiftNums: {
+			"`": "~", "1": "!", "2": "@", "3": "#", "4": "$", "5": "%", "6": "^", "7": "&", 
+			"8": "*", "9": "(", "0": ")", "-": "_", "=": "+", ";": ": ", "'": "\"", ",": "<", 
+			".": ">",  "/": "?",  "\\": "|"
+		}
+	};
+
+	function keyHandler( handleObj ) {
+		// Only care when a possible input has been specified
+		if ( typeof handleObj.data !== "string" ) {
+			return;
+		}
+		
+		var origHandler = handleObj.handler,
+			keys = handleObj.data.toLowerCase().split(" ");
+	
+		handleObj.handler = function( event ) {
+			// Don't fire in text-accepting inputs that we didn't directly bind to
+			if ( this !== event.target && (/textarea|select/i.test( event.target.nodeName ) ||
+				 event.target.type === "text") ) {
+				return;
+			}
+			
+			// Keypress represents characters, not special keys
+			var special = event.type !== "keypress" && jQuery.hotkeys.specialKeys[ event.which ],
+				character = String.fromCharCode( event.which ).toLowerCase(),
+				key, modif = "", possible = {};
+
+			// check combinations (alt|ctrl|shift+anything)
+			if ( event.altKey && special !== "alt" ) {
+				modif += "alt+";
+			}
+
+			if ( event.ctrlKey && special !== "ctrl" ) {
+				modif += "ctrl+";
+			}
+			
+			// TODO: Need to make sure this works consistently across platforms
+			if ( event.metaKey && !event.ctrlKey && special !== "meta" ) {
+				modif += "meta+";
+			}
+
+			if ( event.shiftKey && special !== "shift" ) {
+				modif += "shift+";
+			}
+
+			if ( special ) {
+				possible[ modif + special ] = true;
+
+			} else {
+				possible[ modif + character ] = true;
+				possible[ modif + jQuery.hotkeys.shiftNums[ character ] ] = true;
+
+				// "$" can be triggered as "Shift+4" or "Shift+$" or just "$"
+				if ( modif === "shift+" ) {
+					possible[ jQuery.hotkeys.shiftNums[ character ] ] = true;
+				}
+			}
+
+			for ( var i = 0, l = keys.length; i < l; i++ ) {
+				if ( possible[ keys[i] ] ) {
+					return origHandler.apply( this, arguments );
+				}
+			}
+		};
+	}
+
+	jQuery.each([ "keydown", "keyup", "keypress" ], function() {
+		jQuery.event.special[ this ] = { add: keyHandler };
+	});
+
+})( jQuery );

File diff suppressed because it is too large
+ 0 - 0
503/index_files/jquery_008.js


BIN
503/index_files/maintenance.jpg


File diff suppressed because it is too large
+ 0 - 0
503/index_files/materio_search_api_ajax.js


File diff suppressed because it is too large
+ 1 - 0
503/index_files/modernizr-2.js


+ 28 - 0
503/index_files/panels.js

@@ -0,0 +1,28 @@
+
+(function ($) {
+  Drupal.Panels = Drupal.Panels || {};
+
+  Drupal.Panels.autoAttach = function() {
+    if ($.browser.msie) {
+      // If IE, attach a hover event so we can see our admin links.
+      $("div.panel-pane").hover(
+        function() {
+          $('div.panel-hide', this).addClass("panel-hide-hover"); return true;
+        },
+        function() {
+          $('div.panel-hide', this).removeClass("panel-hide-hover"); return true;
+        }
+      );
+      $("div.admin-links").hover(
+        function() {
+          $(this).addClass("admin-links-hover"); return true;
+        },
+        function(){
+          $(this).removeClass("admin-links-hover"); return true;
+        }
+      );
+    }
+  };
+
+  $(Drupal.Panels.autoAttach);
+})(jQuery);

+ 1156 - 0
503/index_files/script.js

@@ -0,0 +1,1156 @@
+// @codekit-prepend "gui.js"
+(function($) {
+
+  Drupal.behaviors.init_theme = {};
+  Drupal.behaviors.init_theme.attach = function (context) {
+    // Growl-style system messages
+    $('#messages-and-help > div.messages:not(.processed)')
+      .addClass('processed')
+      .each(function() {
+        // If a message meets these criteria, we don't autoclose
+        // - contains a link
+        // - is an error or warning
+        // - contains a lenghthy amount of text
+        if ($('a', this).size() || $(this).is('.error') || $(this).is('.warning') || $(this).text().length > 100) {
+          $(this).prepend("<span class='close'>X</span>");
+          $('span.close', this).click(function() {
+            $(this).parent().slideUp('fast');
+          });
+        }
+        else {
+          // This essentially adds a 3 second pause before hiding the message.
+          $(this).animate({opacity:1}, 5000, 'linear', function() {
+            $(this).slideUp('fast');
+          });
+        }
+      });
+  };
+
+  Drupal.behaviors.materio = {};
+  Drupal.behaviors.materio.attach = function(context) {};
+
+  MaterioBaseTheme = function(){
+    var _settings = Drupal.settings,
+        _themeSettings = _settings.materiobasetheme,
+        _strings = _themeSettings.strings,
+        _History = window.History, 
+        _this = this,
+        _$content = $('#content'),
+        _jsp, 
+        _$tooltip = $('<div id="tooltip" class="op-hidden">').appendTo('body'),
+        _$homeUtilities, _$homeBlockDidactique, _hoverHomeDidactique = false, _homeTimeInterval,
+        _touch = $('html').is('.touch'),
+        _statePushed = false,
+        // touch scroll
+        position = {x:null,y:null},
+        translate3d_content = 0,
+        _isFrontNotLogged = $('body').is('.front.not-logged-in'),
+        _isAdhesion = $('body').is('.page-node-11187') || $('body').is('.page-node-11186'),
+        // _isBreveMateriauNodePage = $('body').is('.node-type-breve') || $('body').is('.node-type-materiau');
+        _isBreveMateriauNodePage = _themeSettings.page_callback == 'node_page_view' && (_themeSettings.node_type == 'materiau' || _themeSettings.node_type == 'breve'),
+        _resizeTimer,
+        _max_480 = function(){ return (viewport().width < 479); },
+        _480_768 = function(){ return ( !_max_480() && _max_768() ); },
+        _max_768 = function(){ return (viewport().width < 767); },
+        _768_980 = function(){ return ( !_max_768() && _max_980() ); },
+        _max_980 = function(){ return (viewport().width < 979); },
+        _980_1200 = function(){ return ( !_max_980() && _max_1200() ); },
+        _max_1200 = function(){ return (viewport().width < 1199); };
+
+
+    function init(){
+      // trace('init MaterioBaseTheme');
+      checkIE();
+      initHistoryNav();
+      if(_isFrontNotLogged)
+        initHome();
+      
+      if(_isAdhesion)
+        initAdhesion();
+      
+      initLayout();
+      initInfinitScroller();
+      initEvents();
+      initForms();
+      initKeyboardShortcuts();
+
+      initViewmodes();
+
+      if(_isBreveMateriauNodePage)
+        $.event.trigger({ type : 'resultschanged', container : '#content>.inner-content'});
+
+      setTimeout(function(){
+        $.event.trigger({ type : 'theme-ready' });  
+      },100);
+    };
+
+    /**
+    * checkIE
+    *
+    */
+    function checkIE(){
+      // alert('check ie');
+      if($('.oldie body').size()){
+        alert('Afin de profiter pleinement des fonctionalités de materio.com, nous vous invitons a mettre a jour votre navigateur dans ça denière version. Celui ci n\'étant pas compatible avec les technologie employer par materio.com, vous risquer de rencontrer des difficulter de navigation.');
+      }
+    };
+
+    /**
+    * history navigation
+    */
+    function initHistoryNav(){
+      var state = _History.getState();
+      // _History.log('initial:', state.data, state.title, state.url);
+      _History.Adapter.bind(window,'statechange',onHistoryStateChange);
+      $(document).bind('new-history-page', onNewHistoryPage);
+    };
+
+    function onNewHistoryPage(event){
+      //trace('theme :: onNewHistoryPage', event);
+
+      var title = event.title.replace(/<(?:.|\n)*?>/gm, '')  + ' | ' + _strings.site_name;
+      // trace('MaterioBaseTheme :: onNewHistoryPage : title', title);
+
+      _statePushed = true;
+
+      _History.pushState({content:event.content, pagetitle:event.title}, title, event.path);
+    };
+
+    function onHistoryStateChange(event){
+      // trace('theme :: onHistoryStateChange', event);
+      var state = _History.getState(); 
+      // _History.log('statechange:', state.data, state.title, state.url);
+
+      // google analytics
+      $.event.trigger({
+        type : 'record-stat',
+        path : state.url
+      });
+
+      // TODO:  History : empty content if we go back to the homepage  
+
+      // change the current url for feedbacks
+      $('input[name=location]','#feedback-form').attr('value', state.url);
+
+      $.event.trigger({
+        type:'materio-page-title-refresh-block',
+        title : state.data.pagetitle
+      });
+
+      // this condition is to avoid retriggering probleme when a module pushState and then is retriggered by state-changed
+      if(!_statePushed){
+        _statePushed = false;
+
+        $('.inner-content',_$content).html(state.data.content);
+
+        $.event.trigger('history-state-change');
+      }
+    };
+
+    /**
+    * home
+    */
+    function initHome(){
+      $('img.lazy', '#block-materio-didactique-materio-didactique-home').each(function(){
+        var $img = $(this);
+        $img.attr('src', $img.attr('data-original'));
+      });
+
+      if(_max_768()){
+        initHomeDidactiqueMobile();
+      }else{
+        initHomeDidactiqueDesktop();
+      }
+    };
+
+    function initHomeDidactiqueMobile(){
+      // trace('initHomeDidactiqueMobile');
+      _$homeBlockDidactique = $('#block-materio-didactique-materio-didactique-home');
+      $('.node-didactique', _$homeBlockDidactique)
+        .find('.field-name-title-field')
+          .bind('click', clickOnHomeDidactiqueTitle);
+    };
+
+    function clickOnHomeDidactiqueTitle(e){
+      // trace('clickOnHomeDidactiqueTitle');
+      var $node = $(this).parent('.node-didactique');
+      if($node.is('.opened')){
+        $node.removeClass('opened');//.slideUp();
+      }else{
+        $('.node-didactique', _$homeBlockDidactique).removeClass('opened');//.slideUp();
+        $node.addClass('opened');//.slideDown();
+
+        $('html,body').animate({scrollTop: $node.offset().top - $('#header').h()});
+      }
+    };
+
+    function initHomeDidactiqueDesktop(){
+      // trace("initHomeDidactiqueDesktop");
+      _$homeUtilities = $('#utilities');
+      _$homeBlockDidactique = $('#block-materio-didactique-materio-didactique-home')
+        .append('<div class="slides"/>')
+        .append('<div class="tabs"/>')
+        // .append('<i class="icon-circle-arrow-up"/><i class="icon-circle-arrow-down"/>')
+        .bind('mouseenter', function(event) { _hoverHomeDidactique = true; })
+        .bind('mouseleave', function(event) { _hoverHomeDidactique = false; });
+
+
+      $('.node-didactique',_$homeBlockDidactique).each(function(index) {
+        if(index){
+          $(this).addClass('op-hidden');
+        }else{
+          $(this).addClass('op-visible');
+        }
+        $('.field-name-title-field', this)
+          .clone()
+          .addClass(index ? '' : 'active')
+          .click(function(event){
+            $(this).addClass('active').siblings().removeClass('active');
+            _$homeBlockDidactique.find('.node-didactique').removeClass('op-visible').addClass('op-hidden').eq(index).removeClass('op-hidden').addClass('op-visible');
+          })
+          .appendTo($('.tabs', _$homeBlockDidactique));
+      }).appendTo($('.slides', _$homeBlockDidactique));
+
+      if(!_touch){
+        $(document).bind('scroll', function(event){
+          if($(window).scrollTop() == 0) {
+            if(_$homeUtilities.is('.closed')){
+              _$homeUtilities.removeClass('closed');//.removeClass('scroll-closed');
+              launchHomeDidactiqueInterval();
+              initLayout();  
+            }
+          }else{
+            if(!_$homeUtilities.is('.closed')){
+              _$homeUtilities.addClass('closed');//.addClass('scroll-closed');
+              clearInterval(_homeTimeInterval);
+              initLayout();
+            }
+          }
+        });
+      }
+      // launchHomeDidactiqueInterval();
+
+      $(document)
+        .bind('cbox_complete', function(){ clearInterval(_homeTimeInterval); })
+        .bind('cbox_closed', function(){ launchHomeDidactiqueInterval(); });
+
+      $('.side.oops a').click(function(event) {
+        event.preventDefault();
+      //   $(document).scrollTop(0);
+      //   $('#edit-mail', "#block-materio-user-user-register").focus();
+        window.location.href = $(this).attr('href');
+        return false;
+      });
+    };
+
+    function launchHomeDidactiqueInterval(){
+      _homeTimeInterval = setInterval(function(){
+        if(!_hoverHomeDidactique){
+          var $next = $('.tabs .active', _$homeBlockDidactique).next();
+          if(!$next.length)
+              $next = $('.tabs .active', _$homeBlockDidactique).siblings().eq(0);
+
+          $next.trigger('click');  
+        }
+      }, 15000);
+    };
+
+    /**
+    * layout
+    */
+    function initLayout(){
+      if(!_max_768()){
+        var height = $('#header').h() + $('#tasks').h();
+
+        if(!_max_480() && !_touch ){ 
+          height += $('#utilities').h()+15; 
+        }
+        
+        //$('#main').css('margin-top', height+15);
+        // $('#container').css('padding-top', height+15);
+
+        $('#container').animate({'padding-top':height}, 300);
+
+      }
+    };
+
+    /** 
+    * infinit scroll
+    */
+    function initInfinitScroller(){
+      // trace("initInfinitScroller");
+      $.event.trigger({
+        type : 'init-scroller-pager',
+        pager : $('ul.pager', '#content')
+      });
+      
+      $(document).bind('scroll', function(event){
+        // trace('scroll event binded');
+        checkInfinitScroller();
+      });
+    };
+
+    function checkInfinitScroller(){
+      // trace('checkInfinitScroller');
+      // if(!_touch){
+      // }else{
+        if($(window).scrollTop() + $(window).height() > getDocHeight() - 200) {
+          infinitScrollPager();
+        }
+      // }
+    };
+
+    function infinitScrollPager(){
+      // trace('MaterioBaseTheme :: infinitScrollPager');
+      if($('ul.pager', '#content').length){
+        var $nextpage = $('ul.pager .pager-current', '#content').next(),
+            href = $('a', $nextpage).attr('href');
+        
+        if(href){
+          $.event.trigger({ type : 'record-stat', path : href }); // google analytics
+          $.event.trigger({ type : 'load-scroller-pager', href : href });
+        }
+      }
+    };
+
+    /**
+    * events
+    */
+    function initEvents(){
+      //trace('MaterioBaseTheme :: initEvents');
+
+      $(document)
+        .bind('init-layout', initLayout)
+        .bind('loading-content', onLoadingContent)
+        .bind('loaded-content', onLoadedContent)
+        .bind('resultschanged', onResultsChanged)
+        .bind('resultscompleted', onResultsCompleted)
+        .bind('mybookmarks-block-updated', onMybookmarksBlockUpdate)
+        .bind('mylists-block-builded', onMyListsBlockBuilded)
+        .bind('mylists-block-updated', onMyListsBlockUpdate)
+        .bind('flagGlobalAfterLinkUpdate', onAfterFlaging)
+        .bind('record-stat', onRecordStat)
+        .bind('view-mode-changed', onViewModeChanged);
+      
+      $(window)
+        .bind('resize', onResizeWindow);
+
+      initFlagsEvent();
+
+      $('#block-user-login h2, #block-menu-menu-top-menu h2').bind('click', function(event) {
+        event.preventDefault();
+        $(this).parent('.block').toggleClass('hovered');
+        $('.hovered').not($(this).parent('.block')).removeClass('hovered');
+        return false;
+      });
+
+      $('#block-materio-search-api-materio-search-api-viewmode .viewmode-link').bind('vm-clicked-active', function(event) {
+        $(this).parents('.block').toggleClass('hovered');
+        $('.hovered').not($(this).parents('.block')).removeClass('hovered');
+      });
+
+      $('#block-materio-search-api-materio-search-api-viewmode .viewmode-link').bind('vm-clicked', function(event) {
+        $(this).parents('.block').removeClass('hovered');
+        $('.hovered').not($(this).parents('.block')).removeClass('hovered');
+      });
+    };
+
+    function onLoadingContent(event){
+      _$content.addClass('faded');
+      $('#materio-search-api-search-form').addClass('loading');
+    };
+    
+    function onLoadedContent(event){
+      _$content.removeClass('faded');
+      $('#materio-search-api-search-form').removeClass('loading');
+    };
+
+    function onResultsChanged(event){
+      //trace('MaterioBaseTheme :: onResultsChanged',event);
+      $(document).scrollTop(0);
+
+      onResultsCompleted(event);
+    };
+
+    function onResultsCompleted(event){
+      trace('theme :: onResultsCompleted', event);
+      checkInfinitScroller();
+      if(event.container != undefined){
+  
+        //setTimeout(function(){ // why this time out ?
+          $(event.container).children('.node:not(.listened)') 
+          .bind('mouseenter mousemove click mouseleave', onCardEventDispatcher)
+          .each(function(i){ 
+            // initLayoutCardDispatcher($(this)); 
+            // initLazyLoad(this);
+            protectFigures(this);
+          })
+          .addClass('listened');
+
+        //}, 100);
+      }
+    };
+
+    function onViewModeChanged(event){
+      if(_isBreveMateriauNodePage){
+        // if(!_isloadingresults){
+          $.event.trigger('loading-content');
+          // _isloadingresults = true;
+          // $('#materio-search-api-search-form').addClass('loading');
+          // var nid = 
+          var url = _settings.basePath+_settings.pathPrefix+'materio_search_api_ajax/node/'+_themeSettings.node_nid;
+          $.getJSON(url, 
+            function(json){
+              trace('json', json);
+              // $.event.trigger('resultsloaded');      
+              $.event.trigger('loaded-content');      
+              // _isloadingresults = false;
+              // $('#materio-search-api-search-form').removeClass('loading');
+              $('#content>.inner-content').html(json.node);
+              $.event.trigger({ type : 'resultschanged', container : '#content>.inner-content'});
+          });
+        // }
+      }
+    };
+
+    /**
+    * CARDS
+    */
+    function onCardEventDispatcher(event){
+      // trace('onCardEvent', event);
+      var vmode = event.currentTarget.className.match(/vm-([a-z|A-Z]+)/);
+      var f = 'on_'+event.type+'_'+vmode[1];
+
+      if(typeof _this[f] == 'function')
+        _this[f].call(this, event);
+    };
+
+    // function initLayoutCardDispatcher($card){
+    //   // trace('$card', $card);
+    //   var vmode = $card.attr('class').match(/vm-([a-z|A-Z]+)/);
+    //   var f = 'init_layout_'+vmode[1];
+
+    //   if(typeof _this[f] == 'function')
+    //     _this[f].call(this, $card);
+    // };
+
+    /**
+    * cards small
+    */
+    // MaterioBaseTheme.prototype.init_layout_cardsmall = function($card){
+    //   trace('initLayoutCardBig');
+    // };
+
+    MaterioBaseTheme.prototype.on_mouseenter_cardsmall = function(event){
+      //trace('MaterioBaseTheme :: on_mouseenter_cardsmall', event);
+      showLazyLoadedImages(event.currentTarget);
+
+      _$tooltip
+        .html($('.group_header', this).clone().addClass('smallcard'))
+        .css({
+          top:event.pageY - _$tooltip.h() -5,//- event.layerY,
+          left:event.pageX + 5 + ($(this).w() - event.layerX)
+        })
+        .removeClass('op-hidden').addClass('op-visible');
+    };
+
+    MaterioBaseTheme.prototype.on_mousemove_cardsmall = function(event){
+      // trace('on_mousemove_Card', event);
+      horiHoverImagesSwitcher(event);
+
+      _$tooltip
+        .css({
+          top:event.pageY - _$tooltip.h() -5,// - event.layerY,
+          left:event.pageX + 5 + ($(this).w() - event.layerX)
+        });
+    };
+
+    // MaterioBaseTheme.prototype.on_click_cardsmall = function(event){
+    //   trace('on_click_cardsmall', event);
+    // };
+
+    MaterioBaseTheme.prototype.on_mouseleave_cardsmall = function(event){
+      // trace('on_mouseleave_Card', event);
+      $('.images img.op-visible', this)
+        .removeClass('op-visible').addClass('op-hidden')
+          .eq(0)
+            .removeClass('op-hidden').addClass('op-visible');
+
+      _$tooltip.removeClass('op-visible').addClass('op-hidden');
+    };
+
+    /**
+    * cards medium
+    */
+    // MaterioBaseTheme.prototype.init_layout_cardmedium = function($card){
+      // trace('initLayoutCardMedium');
+      // var ch = $card.h() - $('.group_header', $card).h() -30;
+      // columnsPage($('.field-name-field-description, .field-name-body', $card), 210, ch);
+    // };
+
+    MaterioBaseTheme.prototype.on_mouseenter_cardmedium = function(event){
+      // trace('on_mouseenter_cardmedium');
+      showLazyLoadedImages(event.currentTarget);
+      $card = $(event.currentTarget);
+      if(!$('.columnized', $card).size()){
+        var ch = $card.h() - $('.group_header', $card).h() -30;
+        columnsPage($('.field-name-field-description, .field-name-body', $card), 210, ch);
+        $('.group-side-4', $card).wrapInner('<div class="column-wrapper">').find('.field-item').addClass('dontsplit');
+        columnsPage($('.group_side_4 .column-wrapper', $card), 210, ch); 
+      }
+    };
+
+    MaterioBaseTheme.prototype.on_mousemove_cardmedium = function(event){
+      // trace('on_mousemove_cardmedium');
+      horiHoverImagesSwitcher(event);
+    };
+
+    MaterioBaseTheme.prototype.on_click_cardmedium = function(event){
+      // trace('on_click_cardmedium');
+      sideSwitcher(event);
+    };
+
+    MaterioBaseTheme.prototype.on_mouseleave_cardmedium = function(event){
+      if($('.side.op-visible').is('.oops') || $('.side.op-visible').is('.upgrade')){
+        sideSwitcher(event, 0);
+      }
+    };
+
+    /**
+    * cards Big
+    */
+    // MaterioBaseTheme.prototype.init_layout_cardbig = function($card){
+      //trace('initLayoutCardBig');
+      // columnsPage($('.field-name-field-description, .field-name-body', $card), 425, 270);
+    // };
+
+    MaterioBaseTheme.prototype.on_mouseenter_cardbig = function(event){
+      // trace('on_mouseenter_cardbig');
+      showLazyLoadedImages(event.currentTarget);
+      
+      if(!$('.columnized', event.currentTarget).size()){
+        columnsPage($('.field-name-field-description, .field-name-body', event.currentTarget), 425, 270);
+        $('.group_4', event.currentTarget).wrapInner('<div class="column-wrapper">').find('.field-item').addClass('dontsplit');
+        columnsPage($('.group_4 .column-wrapper', event.currentTarget), 425, 270); 
+      }
+    };
+
+    MaterioBaseTheme.prototype.on_mousemove_cardbig = function(event){
+      // trace('on_mousemove_cardbig');
+      horiHoverImagesSwitcher(event);
+    };
+
+    MaterioBaseTheme.prototype.on_click_cardbig = function(event){
+      //trace('on_click_cardbig');
+      sideSwitcher(event);
+    };
+
+    MaterioBaseTheme.prototype.on_mouseleave_cardbig = function(event){
+      if($('.side.op-visible').is('.oops') || $('.side.op-visible').is('.upgrade')){
+        sideSwitcher(event, 0);
+      }
+    };
+    
+    /**
+    * cards Full
+    */
+    // MaterioBaseTheme.prototype.init_layout_cardfull = function($card){
+    //   trace('initLayoutCardFull');
+      
+    // };
+
+    MaterioBaseTheme.prototype.on_mouseenter_cardfull = function(event){
+      // trace('on_mouseenter_cardfull');
+      showLazyLoadedImages(event.currentTarget);
+    };
+
+    MaterioBaseTheme.prototype.on_mousemove_cardfull = function(event){
+      // trace('on_mousemove_cardfull');
+      horiHoverImagesSwitcher(event);   
+    };
+
+    // MaterioBaseTheme.prototype.on_click_cardfull = function(event){
+    //   trace('on_click_cardfull');
+    // };
+
+    // MaterioBaseTheme.prototype.on_mouseleave_cardfull = function(event){
+    //   trace('on_mouseleave_cardfull');
+    // };
+
+    /**
+    * horiHoverImagesSwitcher
+    */
+    function horiHoverImagesSwitcher(event){
+      // trace('horiHoverImagesSwitcher', event);
+      var $curtar = $(event.currentTarget);
+      if(event.layerX && $curtar.is('.image-ready')  ){ // && !$curtar.is('.image-buged')
+
+        var $imgs = $('.group_images figure', event.currentTarget);
+        if($(event.target).parents('.group_images').length){
+          var imgw = $imgs.eq(0).w(),
+              rapport = imgw/$imgs.length,
+              mx = event.layerX > imgw ? imgw-1 : event.layerX,
+              rapport_pos = Math.floor(mx / rapport);
+          // trace('rapport_pos = '+rapport_pos+' | event.layerX = '+event.layerX);
+          rapport_pos = rapport_pos < 0 ? 0 : ( rapport_pos > ($imgs.length - 1) ? $imgs.length - 1 : rapport_pos);
+
+          if(!$imgs.eq(rapport_pos).is('.op-visible')){
+
+            // google analytics
+            $.event.trigger({
+              type : 'record-stat',
+              categorie : 'Card event',
+              action : 'image slide switch',
+              label : rapport_pos
+            });
+
+            $imgs
+            .removeClass('op-visible').addClass('op-hidden')
+            .eq(rapport_pos)
+              .removeClass('op-hidden').addClass('op-visible');
+          }
+        }else{
+          // $curtar.addClass('image-buged');
+          $imgs.removeClass('op-visible').addClass('op-hidden');
+          $imgs.eq(0).removeClass('op-hidden').addClass('op-visible');
+        }
+
+      }
+    };
+
+    /**
+    * protectImages
+    */
+    function protectFigures(context){
+      // trace('protectFigures');
+      context = context == null ? 'body' : context;
+      $('figure:not(.protected)', context)
+        .append('<img class="blank" src="'+_settings.basePath+_themeSettings.themePath+'/img/blank.gif" />')
+        .addClass('protected')
+        .bind("contextmenu", function(e){ 
+          alert("Cette image est soumise au droit d'auteur."); 
+          return false; 
+        });
+    }
+
+    /**
+    * lazyloadimages
+    */
+    // unused
+    function initLazyLoad(context){
+      // $('figure:first-child img.lazy', context).lazyload();//{
+        // container:'#content'
+      // });
+
+      // TODO:  propage this event to the card near it to anticipate the mouseenter  
+      // $(context).bind('mousemove', showLazyLoadedImages);
+    };
+
+    function showLazyLoadedImages(context){
+      //trace('MaterioBaseTheme :: initLazyLoad : mouseenter', this);
+      var $this = $(context);
+
+      if( !$this.is('.lazy-processed') ){
+        $this
+          .addClass('lazy-processed')
+          // .find('figure img.lazy')
+          .find('img.lazy')
+            .each(function(index){
+              var $img = $(this);
+              $img.attr('src', $img.attr('data-original')).removeAttr('data-original');
+            });
+
+        setTimeout(function(){
+          $this.addClass('image-ready');
+        }, 300);
+      }
+    }
+
+    /**
+    * sideSwitcher
+    */
+    function sideSwitcher(event, delta){
+      var $sides = $('.side', event.currentTarget);
+      if($sides.length > 1){
+        if( typeof delta == 'undefined'){
+          var delta = 0;
+          $sides.each(function(i) {
+            if($(this).is('.op-visible')){
+              delta = i+1;
+              return false;
+            }
+          });
+          
+          delta = delta == 0 ? 1 : (delta == $sides.length ? 0 : delta);  
+        }
+        
+        // google analytics
+        $.event.trigger({
+          type : 'record-stat',
+          categorie : 'Card event',
+          action : 'side switch',
+          label : delta
+        });
+
+        $sides.addClass('op-hidden').removeClass('op-visible')
+          .eq(delta).removeClass('op-hidden').addClass('op-visible');  
+      }
+    };
+
+    /**
+    * columnsPage
+    */
+    function columnsPage($elmt, cw, ch){
+      // trace('columnsPage');
+      var cls = Math.ceil($elmt.h()/ch);
+      $elmt
+        .addClass('columnized')
+        .width(cw*cls)
+        .columnize({
+          width:cw,
+          height:ch,
+          lastNeverTallest:true,
+        });
+
+      if(cls > 1){
+
+        $elmt.find('.column').each(function(index) {
+          var $this = $(this);
+          if(!$this.find('*').length){
+            $this.prev().addClass('last');
+            $this.remove();
+            return true;
+          }
+        });
+
+        $elmt.find('.column').each(function(index) {
+          var $this = $(this);
+
+          if(!$this.is('.first'))
+            $this.children('*:first-child').prepend('<span cw="'+cw+'" col="'+(index-1)+'" class="column-switcher prev-column">‹</span> ...');
+          
+          if(!$this.is('.last'))
+            $this.children('*:last-child').append('... <span cw="'+cw+'" col="'+(index+1)+'" class="column-switcher next-column">›</span>');
+        });
+
+        $('.column-switcher', $elmt).bind('click', onColumnSwitcherClick);
+
+
+      }
+    };
+
+    function onColumnSwitcherClick(event){
+      event.preventDefault();
+      //trace('onColumnSwitcherClick', event);
+      
+      var $this = $(event.currentTarget),
+          $columnized = $this.parents('.columnized');
+
+      // google analytics
+      $.event.trigger({
+        type : 'record-stat',
+        categorie : 'Card event',
+        action : 'column switch',
+        label : $this.attr('col')
+      });
+
+      $columnized.css({
+        marginLeft : -1 * $this.attr('cw') * $this.attr('col') +'px'
+      });
+
+      return false;
+    }
+
+    /**
+    * initViewmodes
+    */
+    function initViewmodes(){
+      checkViewmodesResponsive();
+    };
+
+    function checkViewmodesResponsive(){
+      if(_480_768()){
+        if($('.viewmode-link.active').is('.viewmode-cardfull')){
+          $('.viewmode-cardbig').trigger('click');
+        }
+      }else if(_max_480()){
+        if($('.viewmode-link.active').is('.viewmode-cardbig, .viewmode-cardfull')){
+          $('.viewmode-cardmedium').trigger('click');
+        }
+      }
+    };
+
+    /**
+    * FLAGS
+    */
+    function initFlagsEvent(){
+      $('.bookmarks, .mylists .flaged').children('.node:not(.listened)') 
+        .bind('mouseenter mousemove click mouseleave', onCardEventDispatcher)
+        // .each(function(event){ initLayoutCardDispatcher($(this)); })
+        .addClass('listened');
+    };
+
+    function onAfterFlaging(event){
+      //trace('MaterioBaseTheme :: onAfterFlaging', event);
+      // WARNING to use event variables i had to hack flag.js from flag module (change the event declaration)
+      var $target = $(event.link).parents('article.node');
+      if(event.flagStatus == 'flag'){
+        $target.addClass('flaged');
+      }else if(event.flagStatus == 'unflag'){
+        
+        if($('.flag-lists-entity-links a.unflag-action', $target).length == 0)
+          $target.removeClass('flaged');
+
+      }
+    };
+
+    function onMybookmarksBlockUpdate(event){
+      initFlagsEvent();
+      initLayout();
+    };
+
+    function onClickList(event){
+      //trace('onClickList', event);
+      var $link = $(event.currentTarget).addClass('active'),
+          name = $link.attr('name'),
+          $block = $link.parents('.block'),
+          $flaged = $('.flaged.'+name, $block).addClass('active');
+      
+      $link.siblings().removeClass('active');
+      $flaged.siblings().removeClass('active');
+
+      createCookie('materiomyflaglistsopened', name, 1);
+      
+      $flaged.parents('.mylists').height($flaged.h());
+      initLayout();
+    };
+
+    function onMyListsBlockUpdate(event){
+      //trace('MaterioBaseTheme :: onMyListsBlockUpdate', event);
+      initFlagsEvent();
+      initLazyLoad(this);
+      // TODO:  refresh contents (search results) to see new flaglist links.
+      initLayout();
+    };
+    
+    function onMyListsBlockBuilded(event){
+      //trace('MaterioBaseTheme :: onMyListsBlockBuilded', event);
+      // initLazyLoad(event.block);
+      showLazyLoadedImages(event.block);
+    };
+    /**
+    * cards bookmark
+    */
+    // MaterioBaseTheme.prototype.init_layout_bookmark = function($card){
+    //   trace('initLayoutCardBig');
+      
+    // };
+
+    MaterioBaseTheme.prototype.on_mouseenter_bookmark = function(event){
+      //trace('on_mouseenter_bookmark', event);
+      _$tooltip
+        .html($('.group_header', this).clone())
+        .css({
+          top:event.pageY - _$tooltip.h() -5,//- event.layerY,
+          left:event.pageX + 5 + ($(this).w() - event.layerX)
+        })
+        .removeClass('op-hidden').addClass('op-visible');
+    };
+
+    MaterioBaseTheme.prototype.on_mousemove_bookmark = function(event){
+      // trace('on_mousemove_Card', event);
+      // if(event.layerX)
+      //   horiHoverImagesSwitcher(event);
+
+      _$tooltip
+        .css({
+          top:event.pageY - _$tooltip.h() -5,// - event.layerY,
+          left:event.pageX + 5 + ($(this).w() - event.layerX)
+        });
+    };
+
+    // MaterioBaseTheme.prototype.on_click_bookmark = function(event){
+    //   trace('on_click_bookmark', event);
+    // };
+
+    MaterioBaseTheme.prototype.on_mouseleave_bookmark = function(event){
+      // trace('on_mouseleave_Card', event);
+      $('.images img.op-visible', this)
+        .removeClass('op-visible').addClass('op-hidden')
+          .eq(0)
+            .removeClass('op-hidden').addClass('op-visible');
+
+      _$tooltip.removeClass('op-visible').addClass('op-hidden');
+    };
+   
+    /**
+    * keyboradshortcuts
+    */
+    function initKeyboardShortcuts(){
+      var stat_event = { type : 'record-stat', categorie : 'Shortcuts'};
+      
+      $(document).bind('keydown', 'Alt+f',function (evt){
+        if($('#edit-searchfield').size()){
+          stat_event.action = 'Alt+f';
+          stat_event.label = 'Focus on search text field';
+          $.event.trigger(stat_event);
+
+          $('#edit-searchfield').focus();
+
+          return false; 
+        }
+      });
+      
+      $(document).bind('keydown', 'Alt+1',function (evt){
+        if($('a.viewmode-link.viewmode-cardsmall').size()){
+          stat_event.action = 'Alt+1';
+          stat_event.label = 'Change view mode : card small';
+          $.event.trigger(stat_event);
+
+          $('a.viewmode-link.viewmode-cardsmall').click();
+
+          return false; 
+        }
+      });
+      
+      $(document).bind('keydown', 'Alt+2',function (evt){
+        if($('a.viewmode-link.viewmode-cardmedium').size()){
+          stat_event.action = 'Alt+2';
+          stat_event.label = 'Change view mode : card medium';
+          $.event.trigger(stat_event);
+
+          $('a.viewmode-link.viewmode-cardmedium').click();
+
+          return false; 
+        }
+      });
+        
+      $(document).bind('keydown', 'Alt+3',function (evt){
+        if($('a.viewmode-link.viewmode-cardbig').size()){
+          stat_event.action = 'Alt+3';
+          stat_event.label = 'Change view mode : card big';
+          $.event.trigger(stat_event);
+
+          $('a.viewmode-link.viewmode-cardbig').click();
+
+          return false; 
+        }
+      });
+    
+      $(document).bind('keydown', 'Alt+4',function (evt){
+        if($('a.viewmode-link.viewmode-cardfull').size()){
+          stat_event.action = 'Alt+4';
+          stat_event.label = 'Change view mode : card full';
+          $.event.trigger(stat_event);
+
+          $('a.viewmode-link.viewmode-cardfull').click();
+
+          return false; 
+        }
+      });
+    };
+
+    /**
+    * Misc
+    */
+    function onResizeWindow(e){
+      clearInterval(_resizeTimer);
+      _resizeTimer = setTimeout(function(){
+        initLayout();
+        checkViewmodesResponsive();
+      }, 200);
+    };
+
+    /** 
+    * Statics
+    */
+    function initAdhesion(){
+
+      $('#webform-component-membership-options').change(function(event){
+        console.log(event);
+        // if($(event.target).is('#edit-submitted-membership-options-3')){
+        if( $('input[type="radio"]:checked', this).is('#edit-submitted-membership-options-3') ){
+          $('#webform-component-collaborators').show();
+        }else{
+          $('#webform-component-collaborators').hide();
+        }
+      });
+
+      $('.get-link a').bind('click', function(event) {
+        var $this = $(this),
+            $parent = $this.parents('.column'),
+            radio;
+        
+        if($parent.is('.flocon')){
+          radio = "#edit-submitted-membership-options-1";
+        }else if($parent.is('.etoile')){
+          radio = "#edit-submitted-membership-options-2";
+        }else if($parent.is('.cinqetoiles')){
+          radio = "#edit-submitted-membership-options-3";
+        }
+        // $('input', '#edit-submitted-type-dadhesion').attr('checked', false);
+        $(radio).attr('checked', true);
+        $('#webform-component-membership-options').change();
+        $('#content-bottom').css('padding-top', $('#container').css('padding-top'));
+      });
+
+      $("#edit-submitted-membership-options-1").attr('checked', true);
+      $('#webform-component-membership-options').change();
+    };
+
+    /** helpers */
+
+    $.fn.h = function(){
+      if(this.css('height') == undefined)
+        return 0;
+      
+      return parseInt(this.css('height')) + parseInt(this.css('padding-top')) + parseInt(this.css('padding-bottom'));
+    };
+
+    $.fn.w = function(){
+      if(this.css('width') == undefined)
+        return 0;
+    
+      return parseInt(this.css('width')) + parseInt(this.css('padding-left')) + parseInt(this.css('padding-right'));
+    };
+
+    function getDocHeight() {
+        var D = document;
+        return Math.max(
+            Math.max(D.body.scrollHeight, D.documentElement.scrollHeight),
+            Math.max(D.body.offsetHeight, D.documentElement.offsetHeight),
+            Math.max(D.body.clientHeight, D.documentElement.clientHeight)
+        );
+    }
+
+    // http://andylangton.co.uk/articles/javascript/get-viewport-size-javascript/
+    function viewport() {
+      var e = window, a = 'inner';
+      if (!('innerWidth' in window )) {
+        a = 'client';
+        e = document.documentElement || document.body;
+      }
+      return { width : e[ a+'Width' ] , height : e[ a+'Height' ] };
+    }
+
+    /**
+    * Forms
+    */
+    function initForms(){
+      
+      $('#edit-searchfield')
+        .bind('focus', function(event) {
+          var $this = $(this);
+          //$this.attr('value', 'test');
+          // trace('value', $this.val());
+          // trace('default', $this.attr('default'));
+          if($this.val() == $this.attr('default'))
+            $this.val('');
+        })
+        .bind('focusout', function(event) {
+          var $this = $(this);
+          if($this.val() == "")
+            $this.val($this.attr('default'));
+        });
+
+      var id,label, description;
+      $('input.form-text', '#block-user-login, #block-materio-user-user-register').each(function(i) {
+        id = $(this).attr('id');
+        label = $('label[for='+id+']').hide().text();
+        description = $(this).parent().find('.description').hide().text();
+        $(this).attr('placeholder', label).attr('title', description);
+      });
+    }
+
+
+    /** 
+    * cookies 
+    */
+    function createCookie(name,value,days) {
+      if (days) {
+        var date = new Date();
+        date.setTime(date.getTime()+(days*24*60*60*1000));
+        var expires = "; expires="+date.toGMTString();
+      }
+      else var expires = "";
+      document.cookie = name+"="+value+expires+"; path=/";
+    }
+
+    function readCookie(name) {
+      var nameEQ = name + "=";
+      var ca = document.cookie.split(';');
+      for(var i=0;i < ca.length;i++) {
+        var c = ca[i];
+        while (c.charAt(0)==' ') c = c.substring(1,c.length);
+        if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
+      }
+      return null;
+    }
+
+    function eraseCookie(name) {
+      createCookie(name,"",-1);
+    }
+
+    /**
+    * google analytics
+    */
+    function onRecordStat(event){
+      //trace('onRecordStat', event);
+      // path, category, action, opt_label, opt_value
+      if(typeof _gaq !== 'undefined'){
+        if(event.path){
+          _gaq.push(['_trackPageview', event.path]);
+        }else{
+          _gaq.push(['_trackEvent', event.categorie, event.action, event.label, event.value]); 
+        }
+      }
+    }
+
+    init();
+  };
+
+  $(document).ready(function() {
+    var materiobasetheme = new MaterioBaseTheme();
+  });
+  
+
+
+  /**
+ * Attach collapse behavior to the feedback form block.
+ */
+  Drupal.behaviors.feedbackForm = {
+    attach: function (context) {
+      $('#block-feedback-form', context).once('feedback', function () {
+        var $block = $(this);
+        $block.find('span.feedback-link')
+          .prepend('<span id="feedback-form-toggle">feedback</span> ')
+          .css('cursor', 'pointer')
+          .toggle(function () {
+              Drupal.feedbackFormToggle($block, false);
+            },
+            function() {
+              Drupal.feedbackFormToggle($block, true);
+            }
+          );
+        $block.find('form').hide();
+        $block.show();
+      });
+    }
+  };
+
+  /**
+   * Collapse or uncollapse the feedback form block.
+   */
+  Drupal.feedbackFormToggle = function ($block, enable) {
+    $block.find('form').slideToggle('medium');
+    if (enable) {
+      $('#feedback-form-toggle', $block).html('feedback');
+    }
+    else {
+      $('#feedback-form-toggle', $block).html('feedback (close)');
+    }
+  };
+
+
+
+})(jQuery);

Some files were not shown because too many files changed in this diff