aboutsummaryrefslogtreecommitdiff
path: root/guidelines/wikipedia/floatSandwiches.js
diff options
context:
space:
mode:
authorGravatar Jesse Hallett <jesse@galois.com>2014-01-06 10:50:22 -0800
committerGravatar Jesse Hallett <jesse@galois.com>2014-01-06 11:15:49 -0800
commit55cd32bfaf9ed5bc5418751369e46fa1d7f098e8 (patch)
treec5759cf75241a4e6bc0fb31596b69c59a9bdc6b5 /guidelines/wikipedia/floatSandwiches.js
parent0a47eab285bf1c04f48a2d6d84838a98807c8c69 (diff)
Moves rule files to src/
Diffstat (limited to 'guidelines/wikipedia/floatSandwiches.js')
-rw-r--r--guidelines/wikipedia/floatSandwiches.js29
1 files changed, 0 insertions, 29 deletions
diff --git a/guidelines/wikipedia/floatSandwiches.js b/guidelines/wikipedia/floatSandwiches.js
deleted file mode 100644
index ecdcdba..0000000
--- a/guidelines/wikipedia/floatSandwiches.js
+++ /dev/null
@@ -1,29 +0,0 @@
-exports.name = "Floating content on both sides of screen";
-exports.description = "Be careful not to add images or other floating content on both sides of the screen simultaneously.";
-
-exports.rule = function(report) {
- var $topElems = $5('#mw-content-text > *');
- var left = floating($topElems, 'left').toArray().map($);
- var right = floating($topElems, 'right').toArray().map($);
-
- left.forEach(function($l) {
- var ltop = $l.offset().top;
- var lbottom = ltop + $l.outerHeight();
-
- if (right.some(function($r) {
- var rtop = $r.offset().top;
- var rbottom = rtop + $r.outerHeight();
-
- return (rtop > ltop && rtop < lbottom) ||
- (rbottom > ltop && rbottom < lbottom);
- })) {
- report.warning('Left and right floating elements overlap vertically.', $l.get(0));
- }
- });
-};
-
-function floating($elems, leftOrRight) {
- return $elems.filter(function() {
- return $(this).css('float') === leftOrRight;
- });
-}