Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Moving demos to the gh-pages branch.

  • Loading branch information...
commit 10cb5ac8f03ef929aeebdd6558848e4dc4f7d133 1 parent 732b931
Micky Hulse authored
View
8 CHANGELOG.md
@@ -1,5 +1,13 @@
# Changelog
+## v2.0.0
+#### December 23, 2012
+
+* Moved v1.x.x code to `defunct` repository.
+* First release of v2.x.x to Github.
+
+---
+
## vX.X.X
#### Mmmmm [D]D, YYYY
View
23 README.md
@@ -1,25 +1,28 @@
# Responsive ads, on _demand_!
-### Responsive serving of [OpenX](http://www.openx.com) ads based on viewport size!
+### Responsive serving of ads based on viewport size!
---
-#### STATE OF THE REPO
+#### SIMPLE DEMO
-We've had a bumpy road to get where we're at today (to say the least).
+Scan with phone and/or click to view the [latest demo](http://registerguard.github.com/ads-on-demand/demo/):
-My (Micky's) initial testing can be found in this "[**failed**](https://github.com/registerguard/ads-on-demand/tree/failed)" branch, which "faild" for two primary reasons:
+[![qr code](http://chart.apis.google.com/chart?cht=qr&chl=https://github.com/registerguard/ads-on-demand&chs=240x240)](http://registerguard.github.com/ads-on-demand/demo/)
-1. [Horrible ad javascript and markup](https://groups.google.com/d/topic/writecapturejs-users/636Ez8YniPQ/discussion) coming from 3rd parties.
-2. OpenX's code base is a moving target (from what we experienced, OpenX changes their code base every month or two).
+**Note:** Our demo serves ads using [OpenX Enterprise-level ad serving solutions for publishers](http://www.openx.com/publisher/enterprise-ad-server); this repo's concepts and techniques should be easy to adapt to other ad serving software.
-...
+---
+
+#### v1.x.x BRANCH
+
+Many hours of work can be found via the [**defunct**](https://github.com/registerguard/ads-on-demand/tree/defunct) branch, which we abandoned for two primary reasons:
-More details coming soon.
+##### 1. Seriously crappy, third party, HTML and/or javascript!
-
+The crap HTML and/or javascript was a huge problem for when it came to using [writeCapture](https://github.com/iamnoah/writeCapture) or [PostScribe](https://github.com/krux/postscribe/) plugins (example here).
-We've found a working solution! Code to be posted in the next few days.
+##### 2. The moving target that is OpenX's code base!
---
View
38 demo/demo.css
@@ -1,38 +0,0 @@
-/**
- * Boilerplate ad styles.
- */
-
-.advert {
- text-align: center; /* Oldschool centering technique. */
- position: relative; /* Just in case ad decides to `position: absolute;` without a `position: relative;` parent. */
- margin: .75em auto; /* Putting `auto` here to assist `.advert`s that have a width. */
-}
- .advert * {
- /* http://meyerweb.com/eric/tools/css/reset/ */
- font-size: 100%;
- font: inherit;
- border: 0;
- margin: 0 auto;
- padding: 0;
- outline: 0;
- }
- .advert img {
- /* Responsive images: */
- width: auto;
- height: auto;
- max-width: 100%;
- max-height: 100%;
- -ms-interpolation-mode: bicubic;
- }
-
-/*--------------------------------------------------------------------*/
-
-/**
- * Show/hide ads.
- */
-
-.leaderboard_728 { display: none; }
-@media only screen and (min-width: 1005px) {
- .leaderboard_320 { display: none; }
- .leaderboard_728 { display: block; }
-}
View
86 demo/demo.js
@@ -1,86 +0,0 @@
-/**
- * Super basic Ads on Demand example.
- * You'd want to write your own javascript and/or convert the below to something more OOP.
- *
- * @see https://github.com/registerguard/ads-on-demand
- * @see https://github.com/registerguard/js-media-queries
- */
-
-//--------------------------------------------------------------------
-
-/**
- * Builds and returns our `<iframe>` html.
- *
- * @param auid { integer } Ad unit ID.
- * @param width { integer } Width of `<iframe>`.
- * @param height { integer } Height of `<iframe>`.
- */
-
-function make_iframe(auid, width, height) {
-
- return '<iframe src="http://ox-d.registerguard.com/w/1.0/afr?auid=' + auid + '&cb=' + (Math.random() * 10000000000000000) + '"' + 'frameBorder="0" frameSpacing="0" scrolling="no" width="' + width + '" height="' + height + '"><\/iframe>';
-
-}
-
-//--------------------------------------------------------------------
-
-// Simple `onload` checking:
-window.onload = function() {
-
- // Used to count query media query matches:
- flag = 1,
-
- // The `onmediaquery` setup:
- queries = [
-
- // Mobile:
-
- {
-
- context : ['alpha', 'bravo'],
- call_for_each_context : false,
- match : function() {
-
- // Using `flag` to avoid loading ads more than once:
- if (flag <= 2) {
-
- // Inject `<iframe>` into DOM:
- document.getElementById('leaderboard_320').innerHTML = make_iframe(314042, 320, 50);
-
- // Up the flag count:
- flag++;
-
- }
-
- }
-
- },
-
- // Desktop:
-
- {
-
- context : ['charlie', 'delta'],
- call_for_each_context : false,
- match : function() {
-
- if (flag <= 2) {
-
- document.getElementById('leaderboard_728').innerHTML = make_iframe(314041, 728, 90);
-
- flag++;
-
- }
-
- }
-
- }
-
- ];
-
- //--------------------------------------------------------------------
-
- // Initialize the `onmediaquery` plugin:
- oMQ.init(queries);
-
-};
View
37 demo/index.html
@@ -1,37 +0,0 @@
-<!doctype html>
-<html>
-
-<head>
-
- <meta charset="utf-8">
-
- <meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1">
-
- <title>Ads on Demand</title>
-
- <meta name="description" content="">
- <meta name="keywords" content="">
-
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <meta name="apple-mobile-web-app-capable" content="yes">
-
- <link rel="stylesheet" href="plugins/normalize.css">
- <link rel="stylesheet" href="plugins/onmediaquery.css">
- <link rel="stylesheet" href="demo.css">
-
- <!--[if (lt IE 9) & (!IEMobile)]>
- <script src="plugins/respond.min.js"></script>
- <![endif]-->
-
-</head>
-<body>
-
- <div id="leaderboard_728" class="advert leaderboard_728"></div>
-
- <div id="leaderboard_320" class="advert leaderboard_320"></div>
-
- <script src="plugins/onmediaquery.js"></script>
- <script src="demo.js"></script>
-
-</body>
-</html>
View
503 demo/plugins/normalize.css
@@ -1,503 +0,0 @@
-/*! normalize.css v1.0.2 | MIT License | git.io/normalize */
-
-/* ==========================================================================
- HTML5 display definitions
- ========================================================================== */
-
-/**
- * Correct `block` display not defined in IE 6/7/8/9 and Firefox 3.
- */
-
-article,
-aside,
-details,
-figcaption,
-figure,
-footer,
-header,
-hgroup,
-nav,
-section,
-summary {
- display: block;
-}
-
-/**
- * Correct `inline-block` display not defined in IE 6/7/8/9 and Firefox 3.
- */
-
-audio,
-canvas,
-video {
- display: inline-block;
- *display: inline;
- *zoom: 1;
-}
-
-/**
- * Prevent modern browsers from displaying `audio` without controls.
- * Remove excess height in iOS 5 devices.
- */
-
-audio:not([controls]) {
- display: none;
- height: 0;
-}
-
-/**
- * Address styling not present in IE 7/8/9, Firefox 3, and Safari 4.
- * Known issue: no IE 6 support.
- */
-
-[hidden] {
- display: none;
-}
-
-/* ==========================================================================
- Base
- ========================================================================== */
-
-/**
- * 1. Correct text resizing oddly in IE 6/7 when body `font-size` is set using
- * `em` units.
- * 2. Prevent iOS text size adjust after orientation change, without disabling
- * user zoom.
- */
-
-html {
- font-size: 100%; /* 1 */
- -webkit-text-size-adjust: 100%; /* 2 */
- -ms-text-size-adjust: 100%; /* 2 */
-}
-
-/**
- * Address `font-family` inconsistency between `textarea` and other form
- * elements.
- */
-
-html,
-button,
-input,
-select,
-textarea {
- font-family: sans-serif;
-}
-
-/**
- * Address margins handled incorrectly in IE 6/7.
- */
-
-body {
- margin: 0;
-}
-
-/* ==========================================================================
- Links
- ========================================================================== */
-
-/**
- * Address `outline` inconsistency between Chrome and other browsers.
- */
-
-a:focus {
- outline: thin dotted;
-}
-
-/**
- * Improve readability when focused and also mouse hovered in all browsers.
- */
-
-a:active,
-a:hover {
- outline: 0;
-}
-
-/* ==========================================================================
- Typography
- ========================================================================== */
-
-/**
- * Address font sizes and margins set differently in IE 6/7.
- * Address font sizes within `section` and `article` in Firefox 4+, Safari 5,
- * and Chrome.
- */
-
-h1 {
- font-size: 2em;
- margin: 0.67em 0;
-}
-
-h2 {
- font-size: 1.5em;
- margin: 0.83em 0;
-}
-
-h3 {
- font-size: 1.17em;
- margin: 1em 0;
-}
-
-h4 {
- font-size: 1em;
- margin: 1.33em 0;
-}
-
-h5 {
- font-size: 0.83em;
- margin: 1.67em 0;
-}
-
-h6 {
- font-size: 0.67em;
- margin: 2.33em 0;
-}
-
-/**
- * Address styling not present in IE 7/8/9, Safari 5, and Chrome.
- */
-
-abbr[title] {
- border-bottom: 1px dotted;
-}
-
-/**
- * Address style set to `bolder` in Firefox 3+, Safari 4/5, and Chrome.
- */
-
-b,
-strong {
- font-weight: bold;
-}
-
-blockquote {
- margin: 1em 40px;
-}
-
-/**
- * Address styling not present in Safari 5 and Chrome.
- */
-
-dfn {
- font-style: italic;
-}
-
-/**
- * Address styling not present in IE 6/7/8/9.
- */
-
-mark {
- background: #ff0;
- color: #000;
-}
-
-/**
- * Address margins set differently in IE 6/7.
- */
-
-p,
-pre {
- margin: 1em 0;
-}
-
-/**
- * Correct font family set oddly in IE 6, Safari 4/5, and Chrome.
- */
-
-code,
-kbd,
-pre,
-samp {
- font-family: monospace, serif;
- _font-family: 'courier new', monospace;
- font-size: 1em;
-}
-
-/**
- * Improve readability of pre-formatted text in all browsers.
- */
-
-pre {
- white-space: pre;
- white-space: pre-wrap;
- word-wrap: break-word;
-}
-
-/**
- * Address CSS quotes not supported in IE 6/7.
- */
-
-q {
- quotes: none;
-}
-
-/**
- * Address `quotes` property not supported in Safari 4.
- */
-
-q:before,
-q:after {
- content: '';
- content: none;
-}
-
-/**
- * Address inconsistent and variable font size in all browsers.
- */
-
-small {
- font-size: 80%;
-}
-
-/**
- * Prevent `sub` and `sup` affecting `line-height` in all browsers.
- */
-
-sub,
-sup {
- font-size: 75%;
- line-height: 0;
- position: relative;
- vertical-align: baseline;
-}
-
-sup {
- top: -0.5em;
-}
-
-sub {
- bottom: -0.25em;
-}
-
-/* ==========================================================================
- Lists
- ========================================================================== */
-
-/**
- * Address margins set differently in IE 6/7.
- */
-
-dl,
-menu,
-ol,
-ul {
- margin: 1em 0;
-}
-
-dd {
- margin: 0 0 0 40px;
-}
-
-/**
- * Address paddings set differently in IE 6/7.
- */
-
-menu,
-ol,
-ul {
- padding: 0 0 0 40px;
-}
-
-/**
- * Correct list images handled incorrectly in IE 7.
- */
-
-nav ul,
-nav ol {
- list-style: none;
- list-style-image: none;
-}
-
-/* ==========================================================================
- Embedded content
- ========================================================================== */
-
-/**
- * 1. Remove border when inside `a` element in IE 6/7/8/9 and Firefox 3.
- * 2. Improve image quality when scaled in IE 7.
- */
-
-img {
- border: 0; /* 1 */
- -ms-interpolation-mode: bicubic; /* 2 */
-}
-
-/**
- * Correct overflow displayed oddly in IE 9.
- */
-
-svg:not(:root) {
- overflow: hidden;
-}
-
-/* ==========================================================================
- Figures
- ========================================================================== */
-
-/**
- * Address margin not present in IE 6/7/8/9, Safari 5, and Opera 11.
- */
-
-figure {
- margin: 0;
-}
-
-/* ==========================================================================
- Forms
- ========================================================================== */
-
-/**
- * Correct margin displayed oddly in IE 6/7.
- */
-
-form {
- margin: 0;
-}
-
-/**
- * Define consistent border, margin, and padding.
- */
-
-fieldset {
- border: 1px solid #c0c0c0;
- margin: 0 2px;
- padding: 0.35em 0.625em 0.75em;
-}
-
-/**
- * 1. Correct color not being inherited in IE 6/7/8/9.
- * 2. Correct text not wrapping in Firefox 3.
- * 3. Correct alignment displayed oddly in IE 6/7.
- */
-
-legend {
- border: 0; /* 1 */
- padding: 0;
- white-space: normal; /* 2 */
- *margin-left: -7px; /* 3 */
-}
-
-/**
- * 1. Correct font size not being inherited in all browsers.
- * 2. Address margins set differently in IE 6/7, Firefox 3+, Safari 5,
- * and Chrome.
- * 3. Improve appearance and consistency in all browsers.
- */
-
-button,
-input,
-select,
-textarea {
- font-size: 100%; /* 1 */
- margin: 0; /* 2 */
- vertical-align: baseline; /* 3 */
- *vertical-align: middle; /* 3 */
-}
-
-/**
- * Address Firefox 3+ setting `line-height` on `input` using `!important` in
- * the UA stylesheet.
- */
-
-button,
-input {
- line-height: normal;
-}
-
-/**
- * 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio`
- * and `video` controls.
- * 2. Correct inability to style clickable `input` types in iOS.
- * 3. Improve usability and consistency of cursor style between image-type
- * `input` and others.
- * 4. Remove inner spacing in IE 7 without affecting normal text inputs.
- * Known issue: inner spacing remains in IE 6.
- */
-
-button,
-html input[type="button"], /* 1 */
-input[type="reset"],
-input[type="submit"] {
- -webkit-appearance: button; /* 2 */
- cursor: pointer; /* 3 */
- *overflow: visible; /* 4 */
-}
-
-/**
- * Re-set default cursor for disabled elements.
- */
-
-button[disabled],
-html input[disabled] {
- cursor: default;
-}
-
-/**
- * 1. Address box sizing set to content-box in IE 8/9.
- * 2. Remove excess padding in IE 8/9.
- * 3. Remove excess padding in IE 7.
- * Known issue: excess padding remains in IE 6.
- */
-
-input[type="checkbox"],
-input[type="radio"] {
- box-sizing: border-box; /* 1 */
- padding: 0; /* 2 */
- *height: 13px; /* 3 */
- *width: 13px; /* 3 */
-}
-
-/**
- * 1. Address `appearance` set to `searchfield` in Safari 5 and Chrome.
- * 2. Address `box-sizing` set to `border-box` in Safari 5 and Chrome
- * (include `-moz` to future-proof).
- */
-
-input[type="search"] {
- -webkit-appearance: textfield; /* 1 */
- -moz-box-sizing: content-box;
- -webkit-box-sizing: content-box; /* 2 */
- box-sizing: content-box;
-}
-
-/**
- * Remove inner padding and search cancel button in Safari 5 and Chrome
- * on OS X.
- */
-
-input[type="search"]::-webkit-search-cancel-button,
-input[type="search"]::-webkit-search-decoration {
- -webkit-appearance: none;
-}
-
-/**
- * Remove inner padding and border in Firefox 3+.
- */
-
-button::-moz-focus-inner,
-input::-moz-focus-inner {
- border: 0;
- padding: 0;
-}
-
-/**
- * 1. Remove default vertical scrollbar in IE 6/7/8/9.
- * 2. Improve readability and alignment in all browsers.
- */
-
-textarea {
- overflow: auto; /* 1 */
- vertical-align: top; /* 2 */
-}
-
-/* ==========================================================================
- Tables
- ========================================================================== */
-
-/**
- * Remove most spacing between table cells.
- */
-
-table {
- border-collapse: collapse;
- border-spacing: 0;
-}
View
99 demo/plugins/onmediaquery.css
@@ -1,99 +0,0 @@
-@charset "UTF-8";
-
-/*
-**--------------------------------------------------------------------------
-**
-** [ A ]LPHA
-**
-**--------------------------------------------------------------------------
-*/
-
-/**
- * For Android/other browsers:
- */
-
-html { font-family: "alpha"; }
-
-/**
- * Make Opera/other happy:
- */
-
-body:after { content: "alpha"; display: none; }
-
-/**
- * Override `<html>` inheritance:
- */
-
-body { font-family: Arial, sans-serif; } /* Cambria, Georgia, serif */
-
-/*
-**--------------------------------------------------------------------------
-**
-** [ B ]RAVO
-**
-**--------------------------------------------------------------------------
-*/
-
-@media only screen and (min-width: 665px) {
-
- /**
- * For Android/other browsers:
- */
-
- html { font-family: "bravo"; }
-
- /**
- * Make Opera/other happy:
- */
-
- body:after { content: "bravo"; }
-
-}
-
-/*
-**--------------------------------------------------------------------------
-**
-** [ C ]HARLIE
-**
-**--------------------------------------------------------------------------
-*/
-
-@media only screen and (min-width: 1005px) {
-
- /**
- * For Android/other browsers:
- */
-
- html { font-family: "charlie"; }
-
- /**
- * Make Opera/other happy:
- */
-
- body:after { content: "charlie"; }
-
-}
-
-/*
-**--------------------------------------------------------------------------
-**
-** [ D ]ELTA
-**
-**--------------------------------------------------------------------------
-*/
-
-@media only screen and (min-width: 1345px) {
-
- /**
- * For Android/other browsers:
- */
-
- html { font-family: "delta"; }
-
- /**
- * Make Opera/other happy:
- */
-
- body:after { content: "delta"; }
-
-}
View
354 demo/plugins/onmediaquery.js
@@ -1,354 +0,0 @@
-/**
- * onMediaQuery
- *
- * @docs https://github.com/JoshBarr/js-media-queries (original)
- * https://github.com/registerguard/js-media-queries (this fork)
- * @copyright Copyright (c) 2012 Springload.
- * @license Released under the MIT license.
- * http://www.opensource.org/licenses/mit-license.php
- * @patterns 1) Closure 2) Alias 3) Namespace extension.
- * @version 2.0.0
- * @date Wednesday, October 25, 2012
- */
-
-(function(omq) { // rgne.ws/V4HOQy
-
- //--------------------------------------------------------------------------
- //
- // Public methods:
- //
- //--------------------------------------------------------------------------
-
- /**
- * Initializes the `oMQ` object and sets the initial media query callbacks.
- *
- * @param query_array { object } The query object.
- * @constructor
- */
-
- omq.init = function(query_array) {
-
- // rgne.ws/UJ8hYh
- this._callbacks = []; // Container for all callbacks registered with the plugin.
- this._context = ''; // Current active query to be read inside callbacks, as `this._last_context` won't be set when they're called!
- this._last_context = ''; // Current active query.
-
- if (typeof query_array !== 'undefined') {
-
- for (var i = 0, l = query_array.length; i < l; i++) {
-
- this.addQuery(query_array[i]);
-
- }
-
- }
-
- // Add a listener to the `window.resize` event, pass `omq`/`self` as the scope:
- _addEvent(window, 'resize', _listenForChange, omq);
-
- // Figure out which query is active on load:
- _listenForChange.call(this);
-
- };
-
- //--------------------------------------------------------------------
-
- /**
- * Attach a new query to test.
- *
- * @return { object } A reference to the query that was added.
- */
-
- omq.addQuery = function(query_object) {
-
- if (query_object) {
-
- this._callbacks.push(query_object);
-
- if (typeof query_object.context === 'string') {
-
- // If the context is passed as a string then turn it into an array (for unified approach elsewhere in the code):
- query_object.context = [query_object.context];
-
- }
-
- if (typeof query_object.call_for_each_context !== 'boolean') {
-
- // See if "call_for_each_context" is set; if not then set a default (IBID):
- query_object.call_for_each_context = true; // Default
-
- }
-
- if (this._last_context && _inArray(this._last_context, query_object.context)) {
-
- // Fire the added callback if it matches the current context:
- query_object.match();
-
- }
-
- return this._callbacks[this._callbacks.length - 1];
-
- }
-
- };
-
- //--------------------------------------------------------------------
-
- /**
- * Remove a query by reference.
- *
- * @param query_object { object }
- */
-
- omq.removeQuery = function(query_object) {
-
- if (query_object) { // rgne.ws/VpFmUI
-
- var match = -1;
-
- while ((match = this._callbacks.indexOf(query_object)) > -1) {
-
- this._callbacks.splice(match, 1);
-
- }
-
- }
-
- };
-
- //--------------------------------------------------------------------
-
- /**
- * Getter that returns the media query's current context.
- * This method can be called before `oMQ` has been instantiated.
- *
- * @return { string } Returns the current media query's context.
- */
-
- omq.getContext = function() {
-
- return (this._context) ? this._context : _pickContext();
-
- };
-
- //--------------------------------------------------------------------
-
- /**
- * Getter that returns the media query's last context.
- * If there is no last context, then the current context is returned.
- *
- * @return { string } The current media query's context.
- */
-
- omq.getLastContext = function() {
-
- return (this._last_context) ? this._last_context : this._context;
-
- };
-
- //--------------------------------------------------------------------------
- //
- // Private methods:
- //
- //--------------------------------------------------------------------------
-
- /**
- * Binds to the `window.onResize` and checks for media query changes.
- *
- * @this { object } Current instance.
- */
-
- function _listenForChange() {
-
- // Get the value of `:after` or `font-family` from the chosen element style:
- var query_string = _pickContext();
-
- // Do we have a context? Note that Opera doesn't jive with `font-family` on the `<html>` element...
- if (query_string) {
-
- if (query_string !== this._last_context) {
-
- this._context = query_string;
-
- // Unmatched callback:
- _triggerCallbacks.call(this, this._last_context, 'unmatch');
-
- // Matched callback:
- _triggerCallbacks.call(this, this._context, 'match');
-
- }
-
- // Update the last context:
- this._last_context = this._context;
-
- }
-
- }
-
- //--------------------------------------------------------------------
-
- /**
- * Loop through the stored callbacks and execute the ones that are bound to the current context.
- *
- * @this { object } Current instance.
- * @param size { string } The current context.
- * @param key { string } Either "match" or "unmatch".
- */
-
- function _triggerCallbacks(size, key) {
-
- if (size && key) {
-
- var callback_function;
-
- for (var i = 0, l = this._callbacks.length; i < l; i++) {
-
- // Don't call for each context?
- if (this._callbacks[i].call_for_each_context === false) {
-
- if (((key === 'match') && _inArray(this._last_context, this._callbacks[i].context)) || ((key === 'unmatch') && _inArray(this._context, this._callbacks[i].context))) {
-
- continue; // Was previously called, and we don't want to call it for each context.
-
- }
-
- }
-
- callback_function = this._callbacks[i][key]; // Callback function.
-
- if (_inArray(size, this._callbacks[i].context) && (callback_function !== undefined)) {
-
- callback_function(); // Callback!
-
- }
-
- }
-
- }
-
- }
-
- //--------------------------------------------------------------------
-
- /**
- * Swiss Army Knife event binding, in lieu of jQuery.
- *
- * @param elem { object } Target object element.
- * @param type { string } Event type.
- * @param eventHandle { method }
- * @param eventContext { object }
- */
-
- function _addEvent(elem, type, eventHandle, eventContext) {
-
- if (elem) { // @TODO: Should we check the other params?
-
- if (elem.addEventListener) {
-
- // If the browser supports event listeners, use them:
- elem.addEventListener(type, function() { eventHandle.call(eventContext); }, false);
-
- } else if (elem.attachEvent) {
-
- // IE & Opera:
- elem.attachEvent('on' + type, function() { eventHandle.call(eventContext); });
-
- } else {
-
- // Otherwise, replace the current thing bound to `on[whatever]`!
- elem['on' + type] = function() { eventHandle.call(eventContext); }; // @TODO: Consider refactoring.
-
- }
-
- }
-
- }
-
- //--------------------------------------------------------------------
-
- /**
- * Get the current context.
- *
- * @return { string } The currently defined media query.
- */
-
- function _pickContext() {
-
- // Returns the first value that is "truth-like", or the last value, if no values are "truth-like":
- var pick = _contentAfter(document.body) || _fontFamily(document.documentElement);
-
- // Android browsers place a "," after an item in the font family list; most browsers either single or double quote the string:
- return pick.replace(/['",]/g, '');
-
- }
-
- //--------------------------------------------------------------------
-
- /**
- * Checks if "needle" occurs in "haystack".
- *
- * @param needle { mixed } Look for in haystack array.
- * @param haystack { array } Haystack array to search in.
- * @return { boolan } True if the needle occurs, false otherwise.
- */
-
- function _inArray(needle, haystack) {
-
- for (var i = 0, l = haystack.length; i < l; i++) {
-
- if (haystack[i] == needle) {
-
- return true;
-
- }
-
- }
-
- return false;
-
- }
-
- //--------------------------------------------------------------------
-
- /**
- * Get the `font-family` style value of the passed element's style.
- *
- * @param elem { object } The Element that is the root element of the document (for example, the `<html>` element for HTML documents).
- * @return { string } Value or empty string.
- */
-
- function _fontFamily(elem) {
-
- if (elem) {
-
- // return (IE browser?) ? (Return IE fontFamily) : ((W3C browser?) ? (Return W3C font-family) : Return empty string);
- return (elem.currentStyle) ? elem.currentStyle['fontFamily'] : ((window.getComputedStyle) ? window.getComputedStyle(el).getPropertyValue('font-family') : '');
-
- }
-
- }
-
- //--------------------------------------------------------------------
-
- /**
- * Get the `:after` `content` value of from the passed element's style.
- *
- * @param elem { object } The `<body>` or `<frameset>` node of the current document.
- * @return { string } Value or empty string.
- */
-
- function _contentAfter(elem) {
-
- if (elem) {
-
- return (window.getComputedStyle) ? window.getComputedStyle(elem, ':after').getPropertyValue('content') : ''; // getPropertyValue() Returns an empty string in Firefox and Opera and null in Google Chrome and Safari.
-
- }
-
- }
-
- //--------------------------------------------------------------------
-
- return omq; // Expose the API.
-
-}(window.oMQ = window.oMQ || {})); // Use existing namespace or make a new object of that namespace.
View
6 demo/plugins/respond.min.js
@@ -1,6 +0,0 @@
-/*! matchMedia() polyfill - Test a CSS media type/query in JS. Authors & copyright (c) 2012: Scott Jehl, Paul Irish, Nicholas Zakas. Dual MIT/BSD license */
-/*! NOTE: If you're already including a window.matchMedia polyfill via Modernizr or otherwise, you don't need this part */
-window.matchMedia=window.matchMedia||(function(e,f){var c,a=e.documentElement,b=a.firstElementChild||a.firstChild,d=e.createElement("body"),g=e.createElement("div");g.id="mq-test-1";g.style.cssText="position:absolute;top:-100em";d.style.background="none";d.appendChild(g);return function(h){g.innerHTML='&shy;<style media="'+h+'"> #mq-test-1 { width: 42px; }</style>';a.insertBefore(d,b);c=g.offsetWidth==42;a.removeChild(d);return{matches:c,media:h}}})(document);
-
-/*! Respond.js v1.1.0: min/max-width media query polyfill. (c) Scott Jehl. MIT/GPLv2 Lic. j.mp/respondjs */
-(function(e){e.respond={};respond.update=function(){};respond.mediaQueriesSupported=e.matchMedia&&e.matchMedia("only all").matches;if(respond.mediaQueriesSupported){return}var w=e.document,s=w.documentElement,i=[],k=[],q=[],o={},h=30,f=w.getElementsByTagName("head")[0]||s,g=w.getElementsByTagName("base")[0],b=f.getElementsByTagName("link"),d=[],a=function(){var D=b,y=D.length,B=0,A,z,C,x;for(;B<y;B++){A=D[B],z=A.href,C=A.media,x=A.rel&&A.rel.toLowerCase()==="stylesheet";if(!!z&&x&&!o[z]){if(A.styleSheet&&A.styleSheet.rawCssText){m(A.styleSheet.rawCssText,z,C);o[z]=true}else{if((!/^([a-zA-Z:]*\/\/)/.test(z)&&!g)||z.replace(RegExp.$1,"").split("/")[0]===e.location.host){d.push({href:z,media:C})}}}}u()},u=function(){if(d.length){var x=d.shift();n(x.href,function(y){m(y,x.href,x.media);o[x.href]=true;u()})}},m=function(I,x,z){var G=I.match(/@media[^\{]+\{([^\{\}]*\{[^\}\{]*\})+/gi),J=G&&G.length||0,x=x.substring(0,x.lastIndexOf("/")),y=function(K){return K.replace(/(url\()['"]?([^\/\)'"][^:\)'"]+)['"]?(\))/g,"$1"+x+"$2$3")},A=!J&&z,D=0,C,E,F,B,H;if(x.length){x+="/"}if(A){J=1}for(;D<J;D++){C=0;if(A){E=z;k.push(y(I))}else{E=G[D].match(/@media *([^\{]+)\{([\S\s]+?)$/)&&RegExp.$1;k.push(RegExp.$2&&y(RegExp.$2))}B=E.split(",");H=B.length;for(;C<H;C++){F=B[C];i.push({media:F.split("(")[0].match(/(only\s+)?([a-zA-Z]+)\s?/)&&RegExp.$2||"all",rules:k.length-1,hasquery:F.indexOf("(")>-1,minw:F.match(/\(min\-width:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/)&&parseFloat(RegExp.$1)+(RegExp.$2||""),maxw:F.match(/\(max\-width:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/)&&parseFloat(RegExp.$1)+(RegExp.$2||"")})}}j()},l,r,v=function(){var z,A=w.createElement("div"),x=w.body,y=false;A.style.cssText="position:absolute;font-size:1em;width:1em";if(!x){x=y=w.createElement("body");x.style.background="none"}x.appendChild(A);s.insertBefore(x,s.firstChild);z=A.offsetWidth;if(y){s.removeChild(x)}else{x.removeChild(A)}z=p=parseFloat(z);return z},p,j=function(I){var x="clientWidth",B=s[x],H=w.compatMode==="CSS1Compat"&&B||w.body[x]||B,D={},G=b[b.length-1],z=(new Date()).getTime();if(I&&l&&z-l<h){clearTimeout(r);r=setTimeout(j,h);return}else{l=z}for(var E in i){var K=i[E],C=K.minw,J=K.maxw,A=C===null,L=J===null,y="em";if(!!C){C=parseFloat(C)*(C.indexOf(y)>-1?(p||v()):1)}if(!!J){J=parseFloat(J)*(J.indexOf(y)>-1?(p||v()):1)}if(!K.hasquery||(!A||!L)&&(A||H>=C)&&(L||H<=J)){if(!D[K.media]){D[K.media]=[]}D[K.media].push(k[K.rules])}}for(var E in q){if(q[E]&&q[E].parentNode===f){f.removeChild(q[E])}}for(var E in D){var M=w.createElement("style"),F=D[E].join("\n");M.type="text/css";M.media=E;f.insertBefore(M,G.nextSibling);if(M.styleSheet){M.styleSheet.cssText=F}else{M.appendChild(w.createTextNode(F))}q.push(M)}},n=function(x,z){var y=c();if(!y){return}y.open("GET",x,true);y.onreadystatechange=function(){if(y.readyState!=4||y.status!=200&&y.status!=304){return}z(y.responseText)};if(y.readyState==4){return}y.send(null)},c=(function(){var x=false;try{x=new XMLHttpRequest()}catch(y){x=new ActiveXObject("Microsoft.XMLHTTP")}return function(){return x}})();a();respond.update=a;function t(){j(true)}if(e.addEventListener){e.addEventListener("resize",t,false)}else{if(e.attachEvent){e.attachEvent("onresize",t)}}})(this);
Please sign in to comment.
Something went wrong with that request. Please try again.