From e860dca7cc36cb6429788ff5db7c05962b1a1a31 Mon Sep 17 00:00:00 2001 From: Kevin Abel Date: Mon, 24 Aug 2015 17:38:25 -0500 Subject: [PATCH 1/9] Change maincontent forced padding to margin This will provide better support for legacy/unbanded content that has existing padding. This may cause a backward compatibility issue with legacy grids as direct children of maincontent. Also refactors media queries band styles directly into the selectors they apply to. --- wdn/templates_4.0/less/layouts/bands.less | 56 +++++++++-------------- 1 file changed, 21 insertions(+), 35 deletions(-) diff --git a/wdn/templates_4.0/less/layouts/bands.less b/wdn/templates_4.0/less/layouts/bands.less index 2013b1990..f8a4dcd0c 100644 --- a/wdn/templates_4.0/less/layouts/bands.less +++ b/wdn/templates_4.0/less/layouts/bands.less @@ -1,7 +1,13 @@ // implement the same content padding #maincontent > * { - padding-left: @mobile-pad; - padding-right: @mobile-pad; + margin-left: @mobile-pad; + margin-right: @mobile-pad; + + @media @bp3 { + max-width: 60rem; + margin-left: auto; + margin-right: auto; + } } .wdn-band { @@ -9,17 +15,25 @@ clear: both; #maincontent > *& { - padding: 0; + margin: 0; } .wdn-inner-wrapper { .clear-fix(); - padding: 0 @mobile-pad; + padding-left: @mobile-pad; + padding-right: @mobile-pad; @media @bp3 { - padding: 0; + padding-left: 0; + paading-right: 0; + width: 60rem; + margin: 0 auto; + } + + .wdn-text-band& { + max-width: 50rem; } - + #maincontent & { padding-top: 2.369em; padding-bottom: 2.532em; @@ -63,7 +77,7 @@ } } } - + .wdn-stretch { // Use this class for presentational elements that stretch the full-width of the band max-width: 100%; width: 100%; @@ -73,31 +87,3 @@ text-align: center; } } - -@media @bp3 { - #maincontent { - - > * { - max-width: 60rem; - margin-left: auto; - margin-right: auto; - padding-left: 0; - padding-right: 0; - } - } - - .wdn-band { - - .wdn-inner-wrapper { - width: 60rem; - margin: 0 auto; - } - } - - .wdn-text-band { - - .wdn-inner-wrapper { - max-width: 50rem; - } - } -} From d0facefca5a170e5bf0263a7393032bb6759843d Mon Sep 17 00:00:00 2001 From: Kevin Abel Date: Thu, 27 Aug 2015 12:07:20 -0500 Subject: [PATCH 2/9] Revert previous debug instance changes and fix validation of & --- debug.shtml | 28 ++-------------------------- 1 file changed, 2 insertions(+), 26 deletions(-) diff --git a/debug.shtml b/debug.shtml index 132c419fc..b77dbf055 100644 --- a/debug.shtml +++ b/debug.shtml @@ -94,30 +94,6 @@
-
-
- Play Video -
- - -
-
-
This is my button @@ -159,7 +135,7 @@
-

Roof party freegan lomo Dreamcatcher mumblecore sartorial bitters. Artisan bitters photo booth, American Apparel Bushwick PBR&B salvia Echo Park.

+

Roof party freegan lomo Dreamcatcher mumblecore sartorial bitters. Artisan bitters photo booth, American Apparel Bushwick PBR&B salvia Echo Park.

Before they sold out Truffaut whatever scenester cred forage Odd Future Schlitz tote bag. Cosby sweater selvage whatever, Carles tofu meh vegan pickled Marfa. Thundercats kitsch post-ironic XOXO, +1 wolf kale chips Odd Future try-hard banjo selvage forage flexitarian ethnic.

@@ -205,7 +181,7 @@ -

Dreamcatcher mumblecore sartorial bitters. Artisan bitters photo booth, American Apparel Bushwick PBR&B salvia Echo Park. Roof party freegan lomo

+

Dreamcatcher mumblecore sartorial bitters. Artisan bitters photo booth, American Apparel Bushwick PBR&B salvia Echo Park. Roof party freegan lomo

Before they sold out Truffaut whatever scenester cred forage Odd Future Schlitz tote bag. Cosby sweater selvage whatever, Carles tofu meh vegan pickled Marfa. Thundercats kitsch post-ironic XOXO, +1 wolf kale chips Odd Future try-hard banjo selvage forage flexitarian ethnic.

From e516cea3eac8fc56564fdf49ba328fb2d90e2658 Mon Sep 17 00:00:00 2001 From: Kevin Abel Date: Thu, 27 Aug 2015 13:12:27 -0500 Subject: [PATCH 3/9] Add custom Modernizr feature test for stylesheet load events Webkit and Gecko have implemented working event implementations for the element. This can be used in our loadCSS function. --- wdn/templates_4.0/scripts/modernizr-wdn.js | 81 +++++++++++++++++----- 1 file changed, 62 insertions(+), 19 deletions(-) diff --git a/wdn/templates_4.0/scripts/modernizr-wdn.js b/wdn/templates_4.0/scripts/modernizr-wdn.js index 9f111ea3c..4058579ed 100644 --- a/wdn/templates_4.0/scripts/modernizr-wdn.js +++ b/wdn/templates_4.0/scripts/modernizr-wdn.js @@ -918,33 +918,33 @@ Modernizr.selectorSupported = function(selector) { hasFeature: function() { return false; } - }, + }; - link = doc.createElement("style"); - link.type = 'text/css'; + link = doc.createElement("style"); + link.type = 'text/css'; - (head || root).insertBefore(link, (head || root).firstChild); + (head || root).insertBefore(link, (head || root).firstChild); - sheet = link.sheet || link.styleSheet; + sheet = link.sheet || link.styleSheet; - if (!(sheet && selector)) return false; + if (!(sheet && selector)) return false; - support = impl.hasFeature('CSS2', '') ? + support = impl.hasFeature('CSS2', '') ? - function(selector) { - try { - sheet.insertRule(selector + '{ }', 0); - sheet.deleteRule(sheet.cssRules.length - 1); - } catch (e) { - return false; - } - return true; + function(selector) { + try { + sheet.insertRule(selector + '{ }', 0); + sheet.deleteRule(sheet.cssRules.length - 1); + } catch (e) { + return false; + } + return true; - } : function(selector) { + } : function(selector) { - sheet.cssText = selector + ' { }'; - return sheet.cssText.length !== 0 && !(/unknown/i).test(sheet.cssText) && sheet.cssText.indexOf(selector) === 0; - }; + sheet.cssText = selector + ' { }'; + return sheet.cssText.length !== 0 && !(/unknown/i).test(sheet.cssText) && sheet.cssText.indexOf(selector) === 0; + }; result = support(selector); link.parentNode.removeChild(link); @@ -962,6 +962,49 @@ Modernizr.selectorSupported = function(selector) { } })(); +// custom feature detect for link element onload events +(function() { + var doc = document, + root = doc.documentElement, + head = root.getElementsByTagName('head')[0], + testName = 'linkloadevents', + failTimeout, + onDone, + link = doc.createElement('link'); + + link.rel = 'stylesheet'; + link.href = 'data:text/css;base64,I21vZGVybml6ci1jc3Nsb2Fke2Rpc3BsYXk6bm9uZX0='; + + onDone = function(result) { + Modernizr.addTest(testName, result); + if (link.parentNode) { + link.parentNode.removeChild(link); + } + link = null; + } + + if (!Modernizr.hasEvent('load', link)) { + onDone(false); + return; + } + + link.onload = function() { + clearTimeout(failTimeout); + onDone(!!(link.sheet || link.styleSheet)); + }; + + link.onerror = function() { + clearTimeout(failTimeout); + onDone(true); + }; + + (head || root).insertBefore(link, (head || root).firstChild); + + failTimeout = setTimeout(function() { + onDone(false); + }, 100); +})(); + //Method of allowing calculated values for length units, i.e. width: calc(100%-3em) http://caniuse.com/#search=calc //By @calvein From b1fb783d275476b1741c5695222cd48915165900 Mon Sep 17 00:00:00 2001 From: Kevin Abel Date: Thu, 27 Aug 2015 13:16:51 -0500 Subject: [PATCH 4/9] Improvements to notices plugin markup and styles Implemented HTML5 data attributes for setting the overlay and auto-close period. Updated the example HTML to match. The code remains fully backwards compatible with the css class based initialization. --- wdn/templates_4.0/examples/notice.html | 26 ++--- wdn/templates_4.0/less/modules/notices.less | 44 ++++---- wdn/templates_4.0/scripts/notice.js | 107 ++++++++++++++------ 3 files changed, 112 insertions(+), 65 deletions(-) diff --git a/wdn/templates_4.0/examples/notice.html b/wdn/templates_4.0/examples/notice.html index b1ae42417..6d9a5b4b0 100644 --- a/wdn/templates_4.0/examples/notice.html +++ b/wdn/templates_4.0/examples/notice.html @@ -6,15 +6,12 @@
-
-

This is my Title!

+

This is my Title!

This is my content. This is some link text.

@@ -23,7 +20,7 @@

This is my Title!

Close this notice
-

Great Success!

+

Great Success!

This is my content. This is some link text

@@ -32,7 +29,7 @@

Great Success!

Close this notice
-

Denial Notice!

+

Denial Notice!

This is my content. This is some link text

@@ -41,28 +38,31 @@

Denial Notice!

Close this notice
-

Important Alert!

+

Important Alert!

This is my content. This is some link text

-
+
-

I'm Floating!

-

This notice has classes overlay-header and duration-10 and will vanish on its own.

+

I'm Floating!

+

This notice overlays the header and will vanish on its own in 10 seconds.

-
+
-

Success!

-

This notice has classes affirm, overlay-maincontent, and duration-15

+

Success!

+

This notice overlays the maincontent and will vanish on its own in 15 seconds.

+
diff --git a/wdn/templates_4.0/less/modules/notices.less b/wdn/templates_4.0/less/modules/notices.less index 28e5178ae..d84291b89 100644 --- a/wdn/templates_4.0/less/modules/notices.less +++ b/wdn/templates_4.0/less/modules/notices.less @@ -2,7 +2,7 @@ .colorize-notice(@color) { background-color: @color; - .transition(all ease-out 0.2s); + .transition(background ease-out 0.2s); &:hover { background-color: darken(@color, 2%); @@ -24,10 +24,6 @@ box-shadow: 0 1px 1px 0 fadeout(#000, 50%); .colorize-notice(@triad); - #maincontent > & { - padding: 1em 1em 0.75em; - } - .close { color: #fff; @@ -45,18 +41,18 @@ padding: 0 0 0 4.209em; } - h4, p { + * { margin: 0; - color: #fff; + color: inherit; } - h4 { - padding: 0; + h4, .title { + // match .wdn-sans-caps .sans-serif-font; line-height: 1.333; text-transform: uppercase; letter-spacing: 0.02em; - .rem(13,16); + font-size: inherit; } &:before { @@ -75,10 +71,6 @@ width: 54px; } } - - a, a:hover { - color: #fff; - } } &.affirm { @@ -150,19 +142,27 @@ } } - &[class^="duration"] { - position: absolute; - } - - &.overlay-header, - #maincontent > &.overlay-maincontent { + &.overlay { position: absolute; left: @mobile-pad; right: @mobile-pad; top: 51px; - margin: 0 auto; - max-width: 52rem; + margin-left: auto; + margin-right: auto; + max-width: 50rem; z-index: (@nav-z-index + 2); // above nav text-align: left; + + @media @bp3 { + left: 0; + right: 0; + } + + // override the core max-width to be slimmer + #maincontent > & { + margin-left: auto; + margin-right: auto; + max-width: 50rem; + } } } diff --git a/wdn/templates_4.0/scripts/notice.js b/wdn/templates_4.0/scripts/notice.js index 22360a8f4..9ecd58a18 100644 --- a/wdn/templates_4.0/scripts/notice.js +++ b/wdn/templates_4.0/scripts/notice.js @@ -1,40 +1,87 @@ -/** - * This plugin is intended for use on pages containing wdn_notice - * - * Auto-closing notices are supported. Add a class of duration to the div, - * with an optional time (in seconds) before closing will occur. - * Examples - * class="wdn_notice duration" // closes after 1 second - * class="wdn_notice duration_1" // closes after 1 second - * class="wdn_notice duration_5" // closes after 5 seconds - */ - define(['jquery', 'wdn'], function($, WDN) { + var templateCssFile = 'css/modules/notices.css'; + var selectorNamespace = '.wdn_notice'; + var animationSpeed = 'slow'; + var defaultDuration = 1000; + var durationMultiplier = 1000; // seconds to milliseconds + var initd = false; + + var closeNotice = function($el) { + $el.fadeOut(animationSpeed, function() { + $el.remove(); + }); + }; + var Plugin = { initialize : function() { - WDN.loadCSS(WDN.getTemplateFilePath('css/modules/notices.css')); - $('.wdn_notice .close').click(function() { - $(this).closest('.wdn_notice').fadeOut("slow"); - return false; - }); - $('.wdn_notice[class*=duration]').each(function() { - var el = this; - var duration = 1000; - var dur_class = $(this).attr('class').split('duration-'); - if (dur_class.length > 1) { - duration = dur_class[1]*1000; + // prevent double initialiation + if (!initd) { + WDN.loadCSS(WDN.getTemplateFilePath(templateCssFile)); + + // globally listen for notice close button clicks + $(document).on('click', selectorNamespace + ' .close', function() { + closeNotice($(this).closest(selectorNamespace)); + return false; + }); + + initd = true; + } + + Plugin.launch(); + }, + + launch : function() { + // check each existing notice for special interactive features + $(selectorNamespace).each(function() { + var $el = $(this); + var durationMatch = 'duration'; + var isOverlay = false; + var overlayMatch = 'overlay'; + var overlayHeader = 'header'; + var overlayMaincontent = 'maincontent'; + var overlayClass; + var duration; + + // check for overlay changers + overlayClass = overlayMatch + '-' + overlayHeader; + if ($el.data(overlayMatch) === overlayHeader || $el.is('.' + overlayClass)) { + isOverlay = true; + $el.addClass(overlayMatch).removeClass(overlayClass); + $('#' + overlayHeader).append($el); + } + + overlayClass = overlayMatch + '-' + overlayMaincontent; + if (!isOverlay && ($el.data(overlayMatch) === overlayMaincontent || $el.is('.' + overlayClass))) { + isOverlay = true; + $el.addClass(overlayMatch).removeClass(overlayClass); + $('#' + overlayMaincontent).prepend($el); + } + + // check for auto-closing duration + if ($el.data(durationMatch) || $el.is('[class*=' + durationMatch + '-]')) { + duration = $el.data(durationMatch) * durationMultiplier; + + if (isNaN(duration) || duration < 1) { + $.each($el[0].classList || $el[0].className.split(/\s+/), function(i, className) { + var classMatch = className.match(new RegExp('^' + durationMatch + '-(.+)$')) + if (classMatch) { + duration = classMatch[1] * durationMultiplier; + return false; + } + }); + } + + if (isNaN(duration) || duration < 1) { + duration = defaultDuration; + } + + setTimeout(function() { + closeNotice($el); + }, duration); } - setTimeout(function(){$(el).fadeOut("slow");}, duration); - }); - $('.wdn_notice[class*=overlay-header]').each(function() { - $('#header').append(this); - }); - $('.wdn_notice[class*=overlay-maincontent]').each(function() { - $('#maincontent').prepend(this); }); } }; return Plugin; }); - From ec6096d27f2de77b68ae75cefe1e45110ac0db39 Mon Sep 17 00:00:00 2001 From: Kevin Abel Date: Thu, 27 Aug 2015 14:00:34 -0500 Subject: [PATCH 5/9] Add API to get a template file with version QS param Also removes unused variables --- wdn/templates_4.0/scripts/wdn.js | 85 +++++++++++++++----------------- 1 file changed, 39 insertions(+), 46 deletions(-) diff --git a/wdn/templates_4.0/scripts/wdn.js b/wdn/templates_4.0/scripts/wdn.js index cf0edae1c..d2416ff23 100644 --- a/wdn/templates_4.0/scripts/wdn.js +++ b/wdn/templates_4.0/scripts/wdn.js @@ -1,7 +1,3 @@ -/** - * This file contains the WDN template javascript code. - */ - (function(window, undefined) { var pluginParams = {}, @@ -32,18 +28,12 @@ return url; }; - - var req = function() { - //TODO: Make this work if require is gone - (window.require).apply(this, arguments); - }; - //#TEMPLATE_PATH //#DEPENDENT_PATH var WDN = { - getTemplateFilePath: function(file, withTemplatePath) { + getTemplateFilePath: function(file, withTemplatePath, withVersion) { file = '' + file; var filePath = dependent_path + file; @@ -51,6 +41,17 @@ filePath = template_path + filePath; } + if (withVersion) { + var qsPosition = filePath.indexOf('?'); + if (qsPosition < 0) { + filePath += '?'; + } else if (qsPosition !== filePath.length - 1) { + filePath += '&'; + } + + filePath += 'dep=' + WDN.getDepVersion(); + } + return filePath; }, @@ -59,7 +60,7 @@ */ loadJS: function (url,callback) { url = _sanitizeTemplateUrl(url); - req([url], callback); + window.require([url], callback); }, /** @@ -68,55 +69,48 @@ loadCSS: function (url, callback, checkLoaded, callbackIfLoaded) { url = _sanitizeTemplateUrl(url); - var _getLink = function() { + var e = (function() { var e = document.createElement("link"); e.href = url; e.rel = "stylesheet"; e.type = "text/css"; return e; - }, - e = _getLink(), - dummyObj, + })(), executeCallback = function() { - dummyObj = undefined; - loadedCSS[url] = true; if (loadingCSS[url]) { - for (var i = 0; i < loadingCSS[url].length; i++) { + for (var i = loadingCSS[url].length - 1; i >= 0; i--) { loadingCSS[url][i](); } delete loadingCSS[url]; } }; - if (!callback) { - e.onload = function() { - loadedCSS[url] = true; - }; - _head.appendChild(e); - - return; - } - - // Workaround for webkit and old gecko not firing onload events for - // http://www.backalleycoder.com/2011/03/20/link-tag-css-stylesheet-load-event/ - if (checkLoaded === false || !(url in loadedCSS)) { - if (url in loadingCSS) { - loadingCSS[url].push(callback); - return; + if (callback) { + if (url in loadingCSS) { + loadingCSS[url].push(callback); + return; + } + + loadingCSS[url] = [callback]; + } else if (!(url in loadingCSS)) { + loadingCSS[url] = []; + } + + if (callback && !window.Modernizr.linkloadevents) { + // Workaround for webkit and old gecko not firing onload events for + // http://www.backalleycoder.com/2011/03/20/link-tag-css-stylesheet-load-event/ + var dummyObj = document.createElement('img'); + dummyObj.onerror = executeCallback; + dummyObj.src = url; + } else { + e.onload = executeCallback; } - loadingCSS[url] = [callback]; - - dummyObj = document.createElement('img'); - dummyObj.onerror = executeCallback; - dummyObj.src = url; _head.appendChild(e); - } else { - if (callbackIfLoaded !== false) { - callback(); - } + } else if (callbackIfLoaded !== false) { + callback(); } }, @@ -124,9 +118,8 @@ * Load jQuery included with the templates as WDN.jQuery * * @param callback Called when the document is ready - * @param forceDebug Should the debug jQuery be loaded */ - loadJQuery: function (callback, forceDebug) { + loadJQuery: function (callback) { require(['jquery'], function($) { if (typeof WDN.jQuery === "undefined") { WDN.jQuery = $.noConflict(true); @@ -202,7 +195,7 @@ args = []; } - req([plugin], function(pluginObj) { + window.require([plugin], function(pluginObj) { var defaultOnLoad = onLoad = function () { if (pluginObj && "initialize" in pluginObj) { WDN.log("initializing plugin '" + plugin + "'"); From 6289c0b40c38d2e5047f37b471b5c5207a232d66 Mon Sep 17 00:00:00 2001 From: Kevin Abel Date: Thu, 27 Aug 2015 15:12:55 -0500 Subject: [PATCH 6/9] Ensure all modules use the versioned CSS file loader. --- wdn/templates_4.0/scripts/band_imagery.js | 2 +- wdn/templates_4.0/scripts/carousel.js | 6 +++--- wdn/templates_4.0/scripts/events-band.js | 2 +- wdn/templates_4.0/scripts/events.js | 2 +- wdn/templates_4.0/scripts/extlatin.js | 2 +- wdn/templates_4.0/scripts/form_validation.js | 2 +- wdn/templates_4.0/scripts/jqueryui.js | 6 +++--- wdn/templates_4.0/scripts/mediaelement_wdn.js | 8 ++++---- wdn/templates_4.0/scripts/modal.js | 6 +++--- wdn/templates_4.0/scripts/monthwidget.js | 2 +- wdn/templates_4.0/scripts/notice.js | 2 +- wdn/templates_4.0/scripts/rss_widget.js | 2 +- wdn/templates_4.0/scripts/smallcaps.js | 2 +- wdn/templates_4.0/scripts/tooltip.js | 2 +- wdn/templates_4.0/scripts/unlalert.js | 2 +- 15 files changed, 24 insertions(+), 24 deletions(-) diff --git a/wdn/templates_4.0/scripts/band_imagery.js b/wdn/templates_4.0/scripts/band_imagery.js index 9004a55eb..4a8b90abf 100644 --- a/wdn/templates_4.0/scripts/band_imagery.js +++ b/wdn/templates_4.0/scripts/band_imagery.js @@ -175,7 +175,7 @@ define(['jquery', 'wdn'], function($, WDN) { var Plugin = { initialize : function() { - WDN.loadCSS(WDN.getTemplateFilePath('css/modules/band_imagery.css')); + WDN.loadCSS(WDN.getTemplateFilePath('css/modules/band_imagery.css', true, true)); $('.wdn-scroll-watch').parent().css('position', 'relative'); imageryUpdate(); $(window).load(imageryUpdate).scroll(function() { diff --git a/wdn/templates_4.0/scripts/carousel.js b/wdn/templates_4.0/scripts/carousel.js index 6c0250a1e..d76616ef3 100644 --- a/wdn/templates_4.0/scripts/carousel.js +++ b/wdn/templates_4.0/scripts/carousel.js @@ -6,7 +6,7 @@ define(['wdn', 'require', 'jquery'], function(WDN, require, $) { var defaultSel = '#wdn_Carousel', flexCls = 'flexslider', - pluginPath = './plugins/flexslider/', + pluginPath = 'plugins/flexslider/', initd = false; return { @@ -28,10 +28,10 @@ define(['wdn', 'require', 'jquery'], function(WDN, require, $) { }; if (!initd) { - WDN.loadCSS(require.toUrl(pluginPath + 'css/flexslider.css')); + WDN.loadCSS(WDN.getTemplateFilePath('scripts/' + pluginPath + 'css/flexslider.css', true, true)); WDN.loadJQuery(function(){ - require([pluginPath + 'jquery.flexslider' + min], done); + require(['./' + pluginPath + 'jquery.flexslider' + min], done); }); } else { done(); diff --git a/wdn/templates_4.0/scripts/events-band.js b/wdn/templates_4.0/scripts/events-band.js index 012bdc268..87e41f9ea 100644 --- a/wdn/templates_4.0/scripts/events-band.js +++ b/wdn/templates_4.0/scripts/events-band.js @@ -76,7 +76,7 @@ define(['jquery', 'wdn', 'require', 'moment'], function($, WDN, require, moment) localConfig = $.extend({}, defaultConfig, config); if (localConfig.url && $(localConfig.container).length) { - WDN.loadCSS(WDN.getTemplateFilePath('css/layouts/events-band.css')); + WDN.loadCSS(WDN.getTemplateFilePath('css/layouts/events-band.css', true, true)); fetchEvents(localConfig); } }; diff --git a/wdn/templates_4.0/scripts/events.js b/wdn/templates_4.0/scripts/events.js index 8dcaab35d..723a2e4b4 100644 --- a/wdn/templates_4.0/scripts/events.js +++ b/wdn/templates_4.0/scripts/events.js @@ -82,7 +82,7 @@ define(['jquery', 'wdn', 'require', 'moment'], function($, WDN, require, moment) if (localConfig.url && $(localConfig.container).length) { $(this.container).addClass('wdn-calendar'); - WDN.loadCSS(WDN.getTemplateFilePath('css/layouts/events.css')); + WDN.loadCSS(WDN.getTemplateFilePath('css/layouts/events.css', true, true)); $.getJSON(localConfig.url + 'upcoming/?format=json&limit=' + encodeURIComponent(localConfig.limit), function(data) { display(data, localConfig); } diff --git a/wdn/templates_4.0/scripts/extlatin.js b/wdn/templates_4.0/scripts/extlatin.js index 7ff0b5e8f..c7cd23db6 100644 --- a/wdn/templates_4.0/scripts/extlatin.js +++ b/wdn/templates_4.0/scripts/extlatin.js @@ -20,7 +20,7 @@ define(['jquery', 'wdn', 'require'], function($, WDN, require) { $('head').append($extlatin); // Load WDN small caps styles - WDN.loadCSS(WDN.getTemplateFilePath('css/layouts/extlatin.css')); + WDN.loadCSS(WDN.getTemplateFilePath('css/layouts/extlatin.css', true, true)); } }; }); diff --git a/wdn/templates_4.0/scripts/form_validation.js b/wdn/templates_4.0/scripts/form_validation.js index 036b979cc..41716503d 100644 --- a/wdn/templates_4.0/scripts/form_validation.js +++ b/wdn/templates_4.0/scripts/form_validation.js @@ -1,7 +1,7 @@ define(['wdn', 'require'], function(WDN, require) { return { initialize: function(callback) { - WDN.loadCSS(WDN.getTemplateFilePath('css/layouts/formvalidator.css')); + WDN.loadCSS(WDN.getTemplateFilePath('css/layouts/formvalidator.css', true, true)); WDN.loadJQuery(function() { require(['plugins/validator/jquery.validator.min'], callback); }); diff --git a/wdn/templates_4.0/scripts/jqueryui.js b/wdn/templates_4.0/scripts/jqueryui.js index dba67beb6..7f33b6d8d 100644 --- a/wdn/templates_4.0/scripts/jqueryui.js +++ b/wdn/templates_4.0/scripts/jqueryui.js @@ -1,5 +1,5 @@ define(['wdn', 'require'], function(WDN, require) { - var pluginPath = './plugins/ui/'; + var pluginPath = 'plugins/ui/'; return { initialize: function(callback) { @@ -8,9 +8,9 @@ define(['wdn', 'require'], function(WDN, require) { min = '.min'; } - WDN.loadCSS(require.toUrl(pluginPath + 'css/jquery-ui' + min + '.css')); + WDN.loadCSS(WDN.getTemplateFilePath('scripts/' + pluginPath + 'css/jquery-ui' + min + '.css', true, true)); WDN.loadJQuery(function() { - require([pluginPath + 'jquery-ui' + min], callback); + require(['./' + pluginPath + 'jquery-ui' + min], callback); }); } }; diff --git a/wdn/templates_4.0/scripts/mediaelement_wdn.js b/wdn/templates_4.0/scripts/mediaelement_wdn.js index 3aa053912..c031ffd34 100644 --- a/wdn/templates_4.0/scripts/mediaelement_wdn.js +++ b/wdn/templates_4.0/scripts/mediaelement_wdn.js @@ -3,7 +3,7 @@ * */ define(['jquery', 'wdn', 'require'], function($, WDN, require) { - var pluginPath = './plugins/mediaelement/', + var pluginPath = 'plugins/mediaelement/', initd = false; return { @@ -24,7 +24,7 @@ define(['jquery', 'wdn', 'require'], function($, WDN, require) { } if (!initd) { - WDN.loadCSS(require.toUrl(pluginPath + 'css/mediaelementplayer' + min + '.css')); + WDN.loadCSS(WDN.getTemplateFilePath('scripts/' + pluginPath + 'css/mediaelementplayer' + min + '.css', true, true)); initd = true; } @@ -38,8 +38,8 @@ define(['jquery', 'wdn', 'require'], function($, WDN, require) { } }; - require([pluginPath + 'mediaelement-and-player' + min], function() { - require([pluginPath + 'mep-feature-googleanalytics'], ready); + require(['./' + pluginPath + 'mediaelement-and-player' + min], function() { + require(['./' + pluginPath + 'mep-feature-googleanalytics'], ready); }); } }; diff --git a/wdn/templates_4.0/scripts/modal.js b/wdn/templates_4.0/scripts/modal.js index f90551bf6..a4518017a 100644 --- a/wdn/templates_4.0/scripts/modal.js +++ b/wdn/templates_4.0/scripts/modal.js @@ -1,5 +1,5 @@ define(['wdn', 'require'], function(WDN, require) { - var pluginPath = './plugins/colorbox/', initd = false; + var pluginPath = 'plugins/colorbox/', initd = false; return { initialize : function(callback) { @@ -12,7 +12,7 @@ define(['wdn', 'require'], function(WDN, require) { if (!body.length || !body[0].className.match(/(^|\s)debug(\s|$)/)) { min = '-min'; } - require([pluginPath + 'jquery.colorbox' + min], function() { + require(['./' + pluginPath + 'jquery.colorbox' + min], function() { WDN.jQuery.colorbox.settings.className = 'wdn-main'; callback(); }); @@ -20,7 +20,7 @@ define(['wdn', 'require'], function(WDN, require) { }; if (!initd) { - WDN.loadCSS(require.toUrl(pluginPath + 'css/colorbox.css'), ready); + WDN.loadCSS(WDN.getTemplateFilePath('scripts/' + pluginPath + 'css/colorbox.css', true, true), ready); } else { ready(); } diff --git a/wdn/templates_4.0/scripts/monthwidget.js b/wdn/templates_4.0/scripts/monthwidget.js index 758df5e4b..4d850a1a4 100644 --- a/wdn/templates_4.0/scripts/monthwidget.js +++ b/wdn/templates_4.0/scripts/monthwidget.js @@ -105,7 +105,7 @@ define(['jquery', 'wdn', 'require', 'moment'], function($, WDN, require, moment) localConfig = $.extend({}, config, defaultConfig); if (localConfig.url && $(localConfig.container).length) { - WDN.loadCSS(WDN.getTemplateFilePath('css/layouts/monthwidget.css')); + WDN.loadCSS(WDN.getTemplateFilePath('css/layouts/monthwidget.css', true, true)); $.get(localConfig.url + '?monthwidget&format=hcalendar', function(data) { display(data, localConfig); } diff --git a/wdn/templates_4.0/scripts/notice.js b/wdn/templates_4.0/scripts/notice.js index 9ecd58a18..73e83e7de 100644 --- a/wdn/templates_4.0/scripts/notice.js +++ b/wdn/templates_4.0/scripts/notice.js @@ -16,7 +16,7 @@ define(['jquery', 'wdn'], function($, WDN) { initialize : function() { // prevent double initialiation if (!initd) { - WDN.loadCSS(WDN.getTemplateFilePath(templateCssFile)); + WDN.loadCSS(WDN.getTemplateFilePath(templateCssFile, true, true)); // globally listen for notice close button clicks $(document).on('click', selectorNamespace + ' .close', function() { diff --git a/wdn/templates_4.0/scripts/rss_widget.js b/wdn/templates_4.0/scripts/rss_widget.js index 701edbe9c..20b80e105 100644 --- a/wdn/templates_4.0/scripts/rss_widget.js +++ b/wdn/templates_4.0/scripts/rss_widget.js @@ -33,7 +33,7 @@ define(['jquery', 'wdn', 'require'], function($, WDN, require) { } if (!initd) { - WDN.loadCSS(WDN.getTemplateFilePath('css/modules/rsswidget.css')); + WDN.loadCSS(WDN.getTemplateFilePath('css/modules/rsswidget.css', true, true)); WDN.loadJQuery(function() { require(['plugins/rsswidget/jquery.zrssfeed.min'], function() { initd = true; diff --git a/wdn/templates_4.0/scripts/smallcaps.js b/wdn/templates_4.0/scripts/smallcaps.js index b799e7a88..46a73bafa 100644 --- a/wdn/templates_4.0/scripts/smallcaps.js +++ b/wdn/templates_4.0/scripts/smallcaps.js @@ -20,7 +20,7 @@ define(['jquery', 'wdn', 'require'], function($, WDN, require) { $('head').append($smcaps); // Load WDN small caps styles - WDN.loadCSS(WDN.getTemplateFilePath('css/layouts/smallcaps.css')); + WDN.loadCSS(WDN.getTemplateFilePath('css/layouts/smallcaps.css', true, true)); } }; }); diff --git a/wdn/templates_4.0/scripts/tooltip.js b/wdn/templates_4.0/scripts/tooltip.js index b9923857f..a1c2d559e 100644 --- a/wdn/templates_4.0/scripts/tooltip.js +++ b/wdn/templates_4.0/scripts/tooltip.js @@ -76,7 +76,7 @@ define(['jquery', 'require'], function($, require) { } if (!initd) { - WDN.loadCSS(require.toUrl(pluginPath + wdnStyle + min + '.css')); + WDN.loadCSS(WDN.getTemplateFilePath('scripts/' + pluginPath + wdnStyle + min + '.css', true, true)); require([pluginPath + qtipPlugin + min], function() { initd = true; tooltipSetup(); diff --git a/wdn/templates_4.0/scripts/unlalert.js b/wdn/templates_4.0/scripts/unlalert.js index 219b34dd6..e82eee4eb 100644 --- a/wdn/templates_4.0/scripts/unlalert.js +++ b/wdn/templates_4.0/scripts/unlalert.js @@ -158,7 +158,7 @@ define(['jquery', 'wdn'], function($, WDN) { for (i = 0; i < info.length; i++) { // Add a div to store the html content if (!$alertWrapper.length) { - WDN.loadCSS(WDN.getTemplateFilePath('css/layouts/unlalert.css')); + WDN.loadCSS(WDN.getTemplateFilePath('css/layouts/unlalert.css', true, true)); $alertWrapper = $('
', { 'id': idPrfx, From b28ac10e318f5a69d1c5c3fa10028ea00180f01e Mon Sep 17 00:00:00 2001 From: Kevin Abel Date: Thu, 27 Aug 2015 15:46:14 -0500 Subject: [PATCH 7/9] Fix typo in band padding. --- wdn/templates_4.0/less/layouts/bands.less | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wdn/templates_4.0/less/layouts/bands.less b/wdn/templates_4.0/less/layouts/bands.less index f8a4dcd0c..da54cea24 100644 --- a/wdn/templates_4.0/less/layouts/bands.less +++ b/wdn/templates_4.0/less/layouts/bands.less @@ -25,7 +25,7 @@ @media @bp3 { padding-left: 0; - paading-right: 0; + padding-right: 0; width: 60rem; margin: 0 auto; } From 40e509507b6cc29bb4d167b929b0be3900da4641 Mon Sep 17 00:00:00 2001 From: Kevin Abel Date: Thu, 27 Aug 2015 16:16:50 -0500 Subject: [PATCH 8/9] Use useful variable name for generated link element Appease @mfairchild365. --- wdn/templates_4.0/scripts/wdn.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/wdn/templates_4.0/scripts/wdn.js b/wdn/templates_4.0/scripts/wdn.js index d2416ff23..24545a96d 100644 --- a/wdn/templates_4.0/scripts/wdn.js +++ b/wdn/templates_4.0/scripts/wdn.js @@ -69,12 +69,12 @@ loadCSS: function (url, callback, checkLoaded, callbackIfLoaded) { url = _sanitizeTemplateUrl(url); - var e = (function() { - var e = document.createElement("link"); - e.href = url; - e.rel = "stylesheet"; - e.type = "text/css"; - return e; + var link = (function() { + var link = document.createElement("link"); + link.href = url; + link.rel = "stylesheet"; + link.type = "text/css"; + return link; })(), executeCallback = function() { loadedCSS[url] = true; @@ -105,7 +105,7 @@ dummyObj.onerror = executeCallback; dummyObj.src = url; } else { - e.onload = executeCallback; + link.onload = executeCallback; } _head.appendChild(e); From 1b34c1c4622c174dc3232d967e8e40a9f242cc45 Mon Sep 17 00:00:00 2001 From: Kevin Abel Date: Fri, 28 Aug 2015 09:00:00 -0500 Subject: [PATCH 9/9] Missed an instance of the renamed "e" variable. Fixes a build error. --- wdn/templates_4.0/scripts/wdn.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wdn/templates_4.0/scripts/wdn.js b/wdn/templates_4.0/scripts/wdn.js index 24545a96d..a022e0780 100644 --- a/wdn/templates_4.0/scripts/wdn.js +++ b/wdn/templates_4.0/scripts/wdn.js @@ -108,7 +108,7 @@ link.onload = executeCallback; } - _head.appendChild(e); + _head.appendChild(link); } else if (callbackIfLoaded !== false) { callback(); }