Prtksxna has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/113951

Change subject: Add Triangle/Pokey to the NavigationPopups
......................................................................

Add Triangle/Pokey to the NavigationPopups

* Triangles using the border hack for the white part of the popups
* SVG clipPath on FF and Chrome, using SVG <image>
* Fallback to <img> on browsers with not SVG support

Change-Id: I3b1226051436652edbffe4642176c9a0e405243c
---
M resources/ext.popups.core.js
1 file changed, 18 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Popups 
refs/changes/51/113951/1

diff --git a/resources/ext.popups.core.js b/resources/ext.popups.core.js
index 4aa7750..ec33d6b 100644
--- a/resources/ext.popups.core.js
+++ b/resources/ext.popups.core.js
@@ -17,7 +17,7 @@
                        cache = {},
                        curRequest, // Current API request
                        api = new mw.Api(),
-                       $box; // DOM element of the popup (defined at the end 
of the file)
+                       $svg, $box; // defined at the end of the file
 
                /**
                 * @method sendRequest
@@ -84,6 +84,15 @@
                        });
 
                        return true;
+               }
+
+               /**
+                * @method supportsSVG
+                * Checks for SVG support in browser
+                * @return {boolean}
+                */
+               function supportsSVG () {
+                       return document.implementation.hasFeature( 
'http://www.w3.org/TR/SVG11/feature#Image', '1.1' );
                }
 
                /**
@@ -356,6 +365,14 @@
                        .appendTo( document.body );
 
 
+               // SVG for masking and creating the triangle/pokey
+               if ( supportsSVG() ) {
+                       $svg = $( '<div>' )
+                               .attr( 'id', 'mwe-popups-svg' )
+                               .appendTo( document.body )
+                               .html( '<svg width="0" 
height="0"><defs><clippath id="mwe-popups-mask"><polygon points="0 8, 10 8, 18 
0, 26 8, 1000 8, 1000 1000, 0 1000"/></clippath></defs></svg>' );
+               }
+
        } );
 
        // Util functions that should be separated out into their own files at 
some point

-- 
To view, visit https://gerrit.wikimedia.org/r/113951
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3b1226051436652edbffe4642176c9a0e405243c
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Popups
Gerrit-Branch: master
Gerrit-Owner: Prtksxna <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to