Skip to content

Commit b281546

Browse files
author
Mike Taylor
committed
Merge pull request #853 from webcompat/cssfixme-scripts
Add cssfixme scripts, fixes #850.
2 parents 072ff09 + 931cd68 commit b281546

File tree

8 files changed

+58
-1
lines changed

8 files changed

+58
-1
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
env/
22
node_modules/
3+
git_modules/
34
.DS_Store
45
config.py
56
fabfile.py
@@ -17,6 +18,7 @@ webcompat/static/js/diagnose.js
1718
webcompat/static/js/issues.js
1819
webcompat/static/js/issue-list.js
1920
webcompat/static/js/user-activity.js
21+
webcompat/static/js/cssfixme/cssfixme.js
2022
webcompat/**/*.min.js
2123
webcompat/**/*.min.css
2224
webcompat/**/*.dev.css

.gitmodules

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "git_modules/css-fixme"]
2+
path = git_modules/css-fixme
3+
url = https://github.com/webcompat/css-fixme/

CONTRIBUTING.md

+6
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,9 @@ We use [Grunt](http://gruntjs.com/) as a task runner to perform certain things (
206206
git clone https://github.com/<username>/webcompat.com.git #replace your github username
207207
# change to directory
208208
cd webcompat.com
209+
# check out submodules
210+
git submodule init
211+
git submodule update
209212
# initializing project
210213
[sudo] make install
211214
```
@@ -248,6 +251,9 @@ Windows users should simply download the most recent Python 2.7 installer and ru
248251
git clone [email protected]:username/webcompat.com.git
249252
# change to directory
250253
cd webcompat.com
254+
# check out submodules
255+
git submodule init
256+
git submodule update
251257
# set up virtual environment
252258
[sudo] virtualenv env
253259
source env/bin/activate

git_modules/css-fixme

Submodule css-fixme added at ab14e43

grunt-tasks/concat.js

+8
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,14 @@ module.exports = function(grunt) {
6666
'<%= jsPath %>/lib/user-activity.js'
6767
],
6868
dest: '<%= jsPath %>/user-activity.js'
69+
},
70+
cssFixmeLibs: {
71+
src: [
72+
'git_modules/css-fixme/js/css-browserside.js',
73+
'git_modules/css-fixme/js/css-fixme.js',
74+
'<%= jsPath %>/lib/css-fixme-ui.js'
75+
],
76+
dest: '<%= jsPath %>/cssfixme/cssfixme.js'
6977
}
7078
});
7179
};

grunt-tasks/uglify.js

+4
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ module.exports = function(grunt) {
2727
diagnose: {
2828
src: '<%= concat.diagnose.dest %>',
2929
dest: '<%= jsPath %>/diagnose.min.js'
30+
},
31+
cssFixmeLibs: {
32+
src: '<%= concat.cssFixmeLibs.dest %>',
33+
dest: '<%= jsPath %>/cssfixme.min.js'
3034
}
3135
});
3236
};
+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/* global doTheBigStyleFixing */
2+
addEventListener('load', function() {
3+
4+
function do_fixup() {
5+
var csscode = document.getElementsByTagName('textarea')[0].value;
6+
var pre = document.getElementById('fixedcss');
7+
var compact = document.getElementsByName('compact')[0].checked;
8+
doTheBigStyleFixing(csscode, pre, compact);
9+
}
10+
11+
document.getElementById('btn_do_fixup').addEventListener('click', do_fixup, false);
12+
13+
if (document.getElementsByTagName('textarea')[0].value) {
14+
do_fixup();
15+
}
16+
17+
document.getElementById('fixedcss').addEventListener('dblclick', function(e) {
18+
window.getSelection().removeAllRanges();
19+
var rng = document.createRange();
20+
rng.selectNodeContents(document.getElementById('fixedcss'));
21+
window.getSelection().addRange(rng);
22+
e.preventDefault();
23+
}, false);
24+
25+
}, false);
26+

webcompat/templates/cssfixme.html

+8-1
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,17 @@
99
<p>Paste CSS in this box to see what needs fixing:</p>
1010

1111
<textarea style="width:100%;height:20rem;"></textarea><br/>
12-
<button type="button" onclick="doTheBigStyleFixing(document.getElementsByTagName('textarea')[0].value)">Add standard equivalents for prefixed CSS</button>
12+
<button type="button" id="btn_do_fixup">Add standard equivalents for prefixed CSS</button>
1313
<label>
1414
<input type="checkbox" name="compact">Compact output (whitespace only after closing brace)</label>
1515
<pre id="fixedcss"></pre>
16+
{%- block extrascripts -%}
17+
{%- if config.PRODUCTION or config.DEVELOPMENT -%}
18+
<script src="{{ url_for('static', filename='js/cssfixme.min.js')|bust_cache }}"></script>
19+
{%- else -%}
20+
<script src="{{ url_for('static', filename='js/lib/css-fixme.js') }}"></script>
21+
{%- endif -%}
22+
{%- endblock %}
1623
</main>
1724
</div>
1825
{% endblock %}

0 commit comments

Comments
 (0)