Skip to content

Commit 4282ad5

Browse files
committed
import variables added + Mit licence
1 parent 1e202c3 commit 4282ad5

13 files changed

Lines changed: 4578 additions & 7 deletions

File tree

app/css/app.css

100755100644
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
.protectedIntroBody {
33
margin-bottom: 50px;
44
}
5+
.Private {
6+
display: none;
7+
}
58
.piEditor {
69
margin-bottom: 100px;
710
}
@@ -223,7 +226,7 @@ div.colorpicker div.colorpicker-hue {
223226
}
224227
.protected #menuBottom ul {
225228
list-style: none;
226-
width: 480px;
229+
width: 700px;
227230
margin: 0 auto;
228231
}
229232
.protected #menuBottom ul li {

app/index.html

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,19 @@
8585
<meta name="description" content="Awesome features like contextual typeahead and colorpicker to make smooth bootstrap theme faster." />
8686
<link id="twitterBootstrapLess" rel="stylesheet/less" href="../twitter-bootstrap/less/bootstrap.less">
8787
<link id="twitterResponsiveLess" rel="stylesheet/less" href="../twitter-bootstrap/less/responsive.less">
88-
88+
<script type="text/javascript">
89+
90+
var _gaq = _gaq || [];
91+
_gaq.push(['_setAccount', 'UA-37710723-1']);
92+
_gaq.push(['_trackPageview']);
93+
94+
(function() {
95+
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
96+
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
97+
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
98+
})();
99+
100+
</script>
89101
</head>
90102
<body data-ng-cloak>
91103
<div class="protected">

app/js/controllers.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ function LessCtrl($scope, $http, ap_less) {
3838
var src = keys;
3939

4040
}
41-
console.log();
4241
$(this).typeahead({
4342
source: src,
4443
updater: function (item) {
@@ -94,6 +93,11 @@ function LessCtrl($scope, $http, ap_less) {
9493
},0);
9594
};
9695

96+
$scope.importLessVariables= function (string) {
97+
$scope = ap_less.importVariables($scope, string);
98+
$scope.applyLess();
99+
};
100+
97101
$scope.isViewLoading = false;
98102

99103
$scope.$on('$routeChangeStart', function() {

app/js/controllers.min.js

100755100644
File mode changed.

app/js/services.js

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,45 @@ angular.module('bootstrapVariablesEditor.services', []).
1111

1212
var lessEngine = {};
1313

14+
lessEngine.importVariables = function ($scope, string) {
15+
var regex = {
16+
variable: /^\s*([^:]*)\s*:\s*([^\\;]*)/,
17+
emptyLine: /(^\s*$)/,
18+
comment: /(^\s*\/\/.*[^\r\n]*)/,
19+
commentMulti: /\/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*+\//
20+
};
21+
var parse = function (data){
22+
if(regex.commentMulti.test(data)){
23+
data = data.replace(regex.commentMulti,'');
24+
console.log(data);
25+
}
26+
var variables = [];
27+
var lines = data.split(/\r\n|\r|\n/);
28+
lines.forEach(
29+
function(line){
30+
if(regex.comment.test(line)){
31+
return;
32+
}else if(regex.emptyLine.test(line)){
33+
return;
34+
} else if(regex.variable.test(line)){
35+
var match = line.match(regex.variable);
36+
variables[match[1]] = match[2];
37+
};
38+
}
39+
);
40+
return variables;
41+
};
42+
var vars = parse(string);
43+
for (var i = 0; i < $scope.variables.length; i++ ) {
44+
for (var j = 0; j < $scope.variables[i].data.length; j++ ) {
45+
if (vars[$scope.variables[i].data[j].key]) {
46+
$scope.variables[i].data[j].value = vars[$scope.variables[i].data[j].key];
47+
}
48+
}
49+
}
50+
return $scope;
51+
}
52+
1453
lessEngine.getVariables = function ($scope) {
1554
var variables = {};
1655
for (var i = 0; i < $scope.variables.length; i++ ) {
@@ -21,6 +60,16 @@ angular.module('bootstrapVariablesEditor.services', []).
2160
return variables;
2261
};
2362

63+
/* var => array of variables */
64+
lessEngine.setVariables = function ($scope, vars) {
65+
for (var i = 0; i < $scope.variables.length; i++ ) {
66+
for (var j = 0; j < $scope.variables[i].data.length; j++ ) {
67+
$scope.variables[i].data[j].value = vars[$scope.variables[i].data[j].key];
68+
}
69+
}
70+
return $scope;
71+
};
72+
2473
lessEngine.getKeys = function ($scope) {
2574

2675
var keys = [

app/js/services.min.js

100755100644
File mode changed.

app/less/app.less

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
.protectedIntroBody{
77
margin-bottom: 50px;
88
}
9+
10+
.Private{display: none;}
911
// @end
1012

1113

@@ -242,7 +244,7 @@ div.colorpicker{
242244

243245
ul{
244246
list-style: none;
245-
width: 480px;
247+
width: 700px;
246248
margin: 0 auto;
247249
li{
248250
float: left;

app/less/variables.json

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,5 +253,57 @@
253253
{"key":"@iconWhiteSpritePath", "value":"'../twitter-bootstrap/img/glyphicons-halflings-white.png'", "type": "icons"}
254254

255255
]
256+
},
257+
258+
{
259+
"name" : "Private",
260+
"data": [
261+
{"key":"@zindexDropdown", "value":"1000", "type": "text"},
262+
{"key":"@zindexPopover", "value": "1010", "type": "text"},
263+
{"key":"@zindexTooltip", "value": "1030", "type": "text"},
264+
{"key":"@zindexFixedNavbar", "value": "1030", "type": "text"},
265+
{"key":"@zindexModalBackdrop", "value": "1040", "type": "text"},
266+
{"key":"@zindexModal", "value": "1050", "type": "text"},
267+
268+
{"key":"@navbarInverseBackground", "value": "#111111", "type": "color"},
269+
{"key":"@navbarInverseBackgroundHighlight", "value": "#222222", "type": "color"},
270+
{"key":"@navbarInverseBorder", "value": "#252525", "type": "color"},
271+
272+
{"key":"@navbarInverseText", "value": "@grayLight", "type": "color"},
273+
{"key":"@navbarInverseLinkColor", "value": "@grayLight", "type": "color"},
274+
{"key":"@navbarInverseLinkColorHover", "value": "@white", "type": "color"},
275+
{"key":"@navbarInverseLinkColorActive", "value": "@navbarInverseLinkColorHover", "type": "color"},
276+
{"key":"@navbarInverseLinkBackgroundHover", "value": "transparent", "type": "color"},
277+
{"key":"@navbarInverseLinkBackgroundActive", "value": "@navbarInverseBackground", "type": "color"},
278+
279+
{"key":"@navbarInverseSearchBackground", "value": "lighten(@navbarInverseBackground, 25%)", "type": "color"},
280+
{"key":"@navbarInverseSearchBackgroundFocus", "value": "@white", "type": "color"},
281+
{"key":"@navbarInverseSearchBorder", "value": "@navbarInverseBackground", "type": "color"},
282+
{"key":"@navbarInverseSearchPlaceholderColor", "value": "#ccc", "type": "color"},
283+
284+
{"key":"@navbarInverseBrandColor", "value": "@navbarInverseLinkColor", "type": "color"},
285+
286+
{"key":"@gridColumns", "value": "12", "type": "text"},
287+
{"key":"@gridColumnWidth", "value": "60px", "type": "text"},
288+
{"key":"@gridGutterWidth", "value": "20px", "type": "text"},
289+
{"key":"@gridRowWidth", "value": "(@gridColumns * @gridColumnWidth) + (@gridGutterWidth * (@gridColumns - 1))", "type": "text"},
290+
291+
{"key":"@gridColumnWidth1200", "value": "70px", "type": "text"},
292+
{"key":"@gridGutterWidth1200", "value": "30px", "type": "text"},
293+
{"key":"@gridRowWidth1200", "value": "(@gridColumns * @gridColumnWidth1200) + (@gridGutterWidth1200 * (@gridColumns - 1))", "type": "text"},
294+
295+
{"key":"@gridColumnWidth768", "value": "42px", "type": "text"},
296+
{"key":"@gridGutterWidth768", "value": "20px", "type": "text"},
297+
{"key":"@gridRowWidth768", "value": "(@gridColumns * @gridColumnWidth768) + (@gridGutterWidth768 * (@gridColumns - 1))", "type": "text"},
298+
299+
{"key":"@fluidGridColumnWidth", "value": "percentage(@gridColumnWidth/@gridRowWidth)", "type": "text"},
300+
{"key":"@fluidGridGutterWidth", "value": "percentage(@gridGutterWidth/@gridRowWidth)", "type": "text"},
301+
302+
{"key":"@fluidGridColumnWidth1200", "value": "percentage(@gridColumnWidth1200/@gridRowWidth1200)", "type": "text"},
303+
{"key":"@fluidGridGutterWidth1200", "value": "percentage(@gridGutterWidth1200/@gridRowWidth1200)", "type": "text"},
304+
305+
{"key":"@fluidGridColumnWidth768", "value": "percentage(@gridColumnWidth768/@gridRowWidth768)", "type": "text"},
306+
{"key":"@fluidGridGutterWidth768", "value": "percentage(@gridColumnWidth768/@gridRowWidth768)", "type": "text"}
307+
]
256308
}
257309
]

0 commit comments

Comments
 (0)