From 44998f9142bc6dbe0758c6bb5fb6f70287803211 Mon Sep 17 00:00:00 2001 From: Khanh Le Date: Wed, 23 Apr 2014 17:38:16 +0700 Subject: [PATCH] Allow javascript get some less variables value Push grid variables into body data for javascript use. Example, get small screen size value by jQuery ('body').data('screen-sm'); --- source/plg_system_t3/base-bs3/js/script.js | 23 +++++++++++++++++++++ source/plg_system_t3/base-bs3/less/t3.less | 11 +++++++++- source/plg_system_t3/base/js/script.js | 24 ++++++++++++++++++++++ source/plg_system_t3/base/less/t3.less | 9 ++++++++ 4 files changed, 66 insertions(+), 1 deletion(-) diff --git a/source/plg_system_t3/base-bs3/js/script.js b/source/plg_system_t3/base-bs3/js/script.js index 7933d0b63b..cce456de3c 100644 --- a/source/plg_system_t3/base-bs3/js/script.js +++ b/source/plg_system_t3/base-bs3/js/script.js @@ -13,6 +13,29 @@ !function($){ + // Detect grid-float-breakpoint value and put to $(body) data + $(document).ready(function(){ + var fromClass = 'body-data-holder', + prop = 'content', + $inspector = $('
').css('display', 'none').addClass(fromClass).appendTo($('body')); + + try { + var attrs = window.getComputedStyle( + $inspector[0], ':before' + ).getPropertyValue(prop), + matches = attrs.match(/([\da-z\-]+)/gi), + data = {}; + if (matches && matches.length) { + for (var i=0; i').css('display', 'none').addClass(fromClass).appendTo($('body')); + + try { + var attrs = window.getComputedStyle( + $inspector[0], ':before' + ).getPropertyValue(prop), + matches = attrs.match(/([\da-z\-]+)/gi), + data = {}; + if (matches && matches.length) { + for (var i=0; i