You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devicemap.apache.org by ra...@apache.org on 2013/11/18 15:40:32 UTC

svn commit: r1543040 - in /incubator/devicemap/trunk/browsermap/trunk: package.json src/main/js/bmap.js src/main/js/bmaputil.js src/test/karma.conf.js

Author: radu
Date: Mon Nov 18 14:40:32 2013
New Revision: 1543040

URL: http://svn.apache.org/r1543040
Log:
DMAP-33 - BrowserMap is forwarding the client to a wrong language variant

* extended the filter function used for getting the new url to which a client should be forwarded such that the current variant’s
hreflang is taken into consideration
* cleaned some JSDoc typos and misuse of tags
* bumping version to 1.4.0

Modified:
    incubator/devicemap/trunk/browsermap/trunk/package.json
    incubator/devicemap/trunk/browsermap/trunk/src/main/js/bmap.js
    incubator/devicemap/trunk/browsermap/trunk/src/main/js/bmaputil.js
    incubator/devicemap/trunk/browsermap/trunk/src/test/karma.conf.js

Modified: incubator/devicemap/trunk/browsermap/trunk/package.json
URL: http://svn.apache.org/viewvc/incubator/devicemap/trunk/browsermap/trunk/package.json?rev=1543040&r1=1543039&r2=1543040&view=diff
==============================================================================
--- incubator/devicemap/trunk/browsermap/trunk/package.json (original)
+++ incubator/devicemap/trunk/browsermap/trunk/package.json Mon Nov 18 14:40:32 2013
@@ -1,6 +1,6 @@
 {
   "name": "BrowserMap",
-  "version": "1.4.0-dev",
+  "version": "1.4.0",
   "description": "YABFDL - yet another browser features detection library",
   "main": "index.js",
   "scripts": {

Modified: incubator/devicemap/trunk/browsermap/trunk/src/main/js/bmap.js
URL: http://svn.apache.org/viewvc/incubator/devicemap/trunk/browsermap/trunk/src/main/js/bmap.js?rev=1543040&r1=1543039&r2=1543040&view=diff
==============================================================================
--- incubator/devicemap/trunk/browsermap/trunk/src/main/js/bmap.js (original)
+++ incubator/devicemap/trunk/browsermap/trunk/src/main/js/bmap.js Mon Nov 18 14:40:32 2013
@@ -67,7 +67,7 @@
      *
      * @param {Object} config - a hash object with various properties that can be used to configure BrowserMap
      * <p>
-     * The following proprerties can be be used:
+     * The following properties can be be used:
      *      <ol>
      *          <li><code>config.cookiePrefix</code> - the prefix used to name cookies used throughout the detection</li>
      *          <li><code>config.deviceGroupCookieName</code> - the name of the device group cookie (the final name will be of the form
@@ -111,7 +111,7 @@
             i,
             link,
             headElement,
-            onIE7 = false,
+            onIE7,
             linkHref,
             devgroups;
         onIE7 = navigator.appVersion.indexOf('MSIE 7') !== -1;
@@ -156,15 +156,10 @@
         var alternateSites = BrowserMap.getAllAlternateSites(),
             maxLinkScore = 0,
             alternateSite = null,
-            currentURL = window.location.href,
-            currentURLParameters = BrowserMapUtil.Url.getURLParametersString(currentURL),
             i,
             j,
             linkScore,
             devices;
-        if (currentURLParameters && currentURLParameters !== '') {
-            currentURL = currentURL.substring(0, currentURL.indexOf(currentURLParameters));
-        }
         for (i = 0; i < alternateSites.length; i++) {
             linkScore = 0;
             devices = alternateSites[i].devgroups.split(',');
@@ -266,15 +261,19 @@
      *
      * @param {String} currentURL - the current URL
      * @param {Array} detectedDeviceGroups - the Array of detected device groups
-     * @prama {Attay} urlSelectors - the Array of URL selectors, in the order of their device group ranking
+     * @param {Array} urlSelectors - the Array of URL selectors, in the order of their device group ranking
      * @return {String} the specific URL for the identified device groups
      */
     BrowserMap.getNewURL = function (currentURL, detectedDeviceGroups, urlSelectors) {
         var newURL = null,
+            currentVariant = BrowserMap.getCurrentVariant(),
             alternateSite = BrowserMap.getAlternateSite(detectedDeviceGroups, function(alternateLink) {
                 if (languageOverride && alternateLink.hreflang && alternateLink.hreflang.lastIndexOf(languageOverride) === 0) {
                     return true;
+                } else if (currentVariant && currentVariant.hreflang === alternateLink.hreflang) {
+                    return true;
                 }
+                return false;
             }),
             i,
             dg,
@@ -590,7 +589,8 @@
      * Queries the list of DeviceGroups associated to this BrowserMap object using a DeviceGroup name and returns it if found.
      *
      * @param {String} groupName - the name of the DeviceGroup
-     * @return {DeviceGroup} the DeviceGroup with the respective name, null otherwise
+     * @return {Object} the DeviceGroup with the respective name, <code>null</code> otherwise
+     * @see BrowserMap.addDeviceGroup
      */
     BrowserMap.getDeviceGroupByName = function (groupName) {
         return deviceGroups[groupName];

Modified: incubator/devicemap/trunk/browsermap/trunk/src/main/js/bmaputil.js
URL: http://svn.apache.org/viewvc/incubator/devicemap/trunk/browsermap/trunk/src/main/js/bmaputil.js?rev=1543040&r1=1543039&r2=1543040&view=diff
==============================================================================
--- incubator/devicemap/trunk/browsermap/trunk/src/main/js/bmaputil.js (original)
+++ incubator/devicemap/trunk/browsermap/trunk/src/main/js/bmaputil.js Mon Nov 18 14:40:32 2013
@@ -79,7 +79,7 @@
 
     /**
      * The <code>cookieManager</code> is used to manage cookies client-side (see
-     * {@link https://developer.mozilla.org/en/DOM/document.cookie}).
+     * <a href="https://developer.mozilla.org/en/DOM/document.cookie">https://developer.mozilla.org/en/DOM/document.cookie</a>).
      *
      * @class BrowserMapUtil.CookieManager
      */
@@ -127,7 +127,7 @@
         /**
          * Removes a cookie from the client, if one exists.
          *
-         * @param {Cookie} name - the <code>Cookie</code>'s name
+         * @param {String} name - the <code>Cookie</code>'s name
          */
         removeCookie : function (name) {
             if (!name || !this.cookieExists(name)) { return; }

Modified: incubator/devicemap/trunk/browsermap/trunk/src/test/karma.conf.js
URL: http://svn.apache.org/viewvc/incubator/devicemap/trunk/browsermap/trunk/src/test/karma.conf.js?rev=1543040&r1=1543039&r2=1543040&view=diff
==============================================================================
--- incubator/devicemap/trunk/browsermap/trunk/src/test/karma.conf.js (original)
+++ incubator/devicemap/trunk/browsermap/trunk/src/test/karma.conf.js Mon Nov 18 14:40:32 2013
@@ -67,8 +67,7 @@ module.exports = function(config) {
     singleRun: false,
     // report which specs are slower than 500ms
     // CLI --report-slower-than 500
-    reportSlowerThan: 500,
-    //...
+    reportSlowerThan: 500
   });
 };