Unverified Commit 416002f1 authored by Andy Blum's avatar Andy Blum Committed by Mateu Aguiló Bosch
Browse files

Issue #3069162 by andy-blum, abhisekmazumdar, miwayha, wturrell, e0ipso,...

Issue #3069162 by andy-blum, abhisekmazumdar, miwayha, wturrell, e0ipso, joco_sp, extect: Unwanted brackets ( ( ) ) being added to <title> tag by JS
parent 9e1f0dab
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -9,3 +9,4 @@ drupal.environment_indicator:
      css/environment_indicator.css: {}
  dependencies:
    - color/drupal.color
    - core/jquery.once
+12 −10
Original line number Diff line number Diff line
@@ -30,16 +30,18 @@

  Drupal.behaviors.environmentIndicatorTinycon = {
    attach: function (context, settings) {
      $('html').once('env-ind-tinycon').each(function() {
        if (typeof(settings.environmentIndicator) != 'undefined' &&
          typeof(settings.environmentIndicator.addFavicon) != 'undefined' &&
          settings.environmentIndicator.addFavicon) {
          // Draw favicon label.
        Tinycon.setBubble(settings.environmentIndicator.name.slice(0, 1));
          Tinycon.setBubble(settings.environmentIndicator.name.slice(0, 1).trim());
          Tinycon.setOptions({
            background: settings.environmentIndicator.bgColor,
            colour: settings.environmentIndicator.fgColor
          });
        }
      })
    }
  }

+1 −2
Original line number Diff line number Diff line
@@ -3,6 +3,5 @@
 * Tom Moor, http://tommoor.com
 * Copyright (c) 2015 Tom Moor
 * @license MIT Licensed
 * @version 0.6.4
 */
!function(){var a={},b=null,c=null,d=null,e=null,f={},g=window.devicePixelRatio||1,h=16*g,i={width:7,height:9,font:10*g+"px arial",colour:"#ffffff",background:"#F03D25",fallback:!0,crossOrigin:!0,abbreviate:!0},j=function(){var a=navigator.userAgent.toLowerCase();return function(b){return-1!==a.indexOf(b)}}(),k={ie:j("msie"),chrome:j("chrome"),webkit:j("chrome")||j("safari"),safari:j("safari")&&!j("chrome"),mozilla:j("mozilla")&&!j("chrome")&&!j("safari")},l=function(){for(var a=document.getElementsByTagName("link"),b=0,c=a.length;c>b;b++)if((a[b].getAttribute("rel")||"").match(/\bicon\b/))return a[b];return!1},m=function(){for(var a=document.getElementsByTagName("link"),b=document.getElementsByTagName("head")[0],c=0,d=a.length;d>c;c++){var e="undefined"!=typeof a[c];e&&(a[c].getAttribute("rel")||"").match(/\bicon\b/)&&b.removeChild(a[c])}},n=function(){if(!c||!b){var a=l();c=b=a?a.getAttribute("href"):"/favicon.ico"}return b},o=function(){return e||(e=document.createElement("canvas"),e.width=h,e.height=h),e},p=function(a){if(a){m();var b=document.createElement("link");b.type="image/x-icon",b.rel="icon",b.href=a,document.getElementsByTagName("head")[0].appendChild(b)}},q=function(a,b){if(!o().getContext||k.ie||k.safari||"force"===f.fallback)return r(a);var c=o().getContext("2d"),b=b||"#000000",e=n();d=document.createElement("img"),d.onload=function(){c.clearRect(0,0,h,h),c.drawImage(d,0,0,d.width,d.height,0,0,h,h),(a+"").length>0&&s(c,a,b),t()},!e.match(/^data/)&&f.crossOrigin&&(d.crossOrigin="anonymous"),d.src=e},r=function(a){if(f.fallback){var b=document.title;"("===b[0]&&(b=b.slice(b.indexOf(" "))),(a+"").length>0?document.title="("+a+") "+b:document.title=b}},s=function(a,b,c){"number"==typeof b&&b>99&&f.abbreviate&&(b=u(b));var d=(b+"").length-1,e=f.width*g+6*g*d,i=f.height*g,j=h-i,l=h-e-g,m=16*g,n=16*g,o=2*g;a.font=(k.webkit?"bold ":"")+f.font,a.fillStyle=f.background,a.strokeStyle=f.background,a.lineWidth=g,a.beginPath(),a.moveTo(l+o,j),a.quadraticCurveTo(l,j,l,j+o),a.lineTo(l,m-o),a.quadraticCurveTo(l,m,l+o,m),a.lineTo(n-o,m),a.quadraticCurveTo(n,m,n,m-o),a.lineTo(n,j+o),a.quadraticCurveTo(n,j,n-o,j),a.closePath(),a.fill(),a.beginPath(),a.strokeStyle="rgba(0,0,0,0.3)",a.moveTo(l+o/2,m),a.lineTo(n-o/2,m),a.stroke(),a.fillStyle=f.colour,a.textAlign="right",a.textBaseline="top",a.fillText(b,2===g?29:15,k.mozilla?7*g:6*g)},t=function(){o().getContext&&p(o().toDataURL())},u=function(a){for(var b=[["G",1e9],["M",1e6],["k",1e3]],c=0;c<b.length;++c)if(a>=b[c][1]){a=v(a/b[c][1])+b[c][0];break}return a},v=function(a,b){var c=new Number(a);return c.toFixed(b)};a.setOptions=function(a){f={};for(var b in i)f[b]=a.hasOwnProperty(b)?a[b]:i[b];return this},a.setImage=function(a){return b=a,t(),this},a.setBubble=function(a,b){return a=a||"",q(a,b),this},a.reset=function(){p(c)},a.setOptions(i),"function"==typeof define&&define.amd?define(a):"undefined"!=typeof module?module.exports=a:window.Tinycon=a}();
!function () { var a = {}, b = null, c = null, d = null, e = null, f = {}, g = Math.ceil(window.devicePixelRatio) || 1, h = 16 * g, i = { width: 7, height: 9, font: 10 * g + "px arial", color: "#ffffff", background: "#F03D25", fallback: !0, crossOrigin: !0, abbreviate: !0 }, j = function () { var a = navigator.userAgent.toLowerCase(); return function (b) { return a.indexOf(b) !== -1 } }(), k = { ie: j("trident"), chrome: j("chrome"), webkit: j("chrome") || j("safari"), safari: j("safari") && !j("chrome"), mozilla: j("mozilla") && !j("chrome") && !j("safari") }, l = function () { for (var a = document.getElementsByTagName("link"), b = 0, c = a.length; b < c; b++)if ((a[b].getAttribute("rel") || "").match(/\bicon\b/i)) return a[b]; return !1 }, m = function () { for (var a = document.getElementsByTagName("link"), b = 0, c = a.length; b < c; b++) { void 0 !== a[b] && (a[b].getAttribute("rel") || "").match(/\bicon\b/i) && a[b].parentNode.removeChild(a[b]) } }, n = function () { if (!c || !b) { var a = l(); b = a ? a.getAttribute("href") : "/favicon.ico", c || (c = b) } return b }, o = function () { return e || (e = document.createElement("canvas"), e.width = h, e.height = h), e }, p = function (a) { if (a) { m(); var b = document.createElement("link"); b.type = "image/x-icon", b.rel = "icon", b.href = a, document.getElementsByTagName("head")[0].appendChild(b) } }, q = function (a, b) { if (!o().getContext || k.ie || k.safari || "force" === f.fallback) return r(a); var c = o().getContext("2d"), b = b || "#000000", e = n(); d = document.createElement("img"), d.onload = function () { c.clearRect(0, 0, h, h), c.drawImage(d, 0, 0, d.width, d.height, 0, 0, h, h), (a + "").length > 0 && s(c, a, b), t() }, !e.match(/^data/) && f.crossOrigin && (d.crossOrigin = "anonymous"), d.src = e }, r = function (a) { if (f.fallback) { var b = document.title; "(" === b[0] && (b = b.slice(b.indexOf(" "))), (a + "").length > 0 ? document.title = "(" + a + ") " + b : document.title = b } }, s = function (a, b, c) { "number" == typeof b && b > 99 && f.abbreviate && (b = u(b)); var d = (b + "").length - 1, e = f.width * g + 6 * g * d, i = f.height * g, j = h - i, l = h - e - g, m = 16 * g, n = 16 * g, o = 2 * g; a.font = (k.webkit ? "bold " : "") + f.font, a.fillStyle = f.background, a.strokeStyle = f.background, a.lineWidth = g, a.beginPath(), a.moveTo(l + o, j), a.quadraticCurveTo(l, j, l, j + o), a.lineTo(l, m - o), a.quadraticCurveTo(l, m, l + o, m), a.lineTo(n - o, m), a.quadraticCurveTo(n, m, n, m - o), a.lineTo(n, j + o), a.quadraticCurveTo(n, j, n - o, j), a.closePath(), a.fill(), a.beginPath(), a.strokeStyle = "rgba(0,0,0,0.3)", a.moveTo(l + o / 2, m), a.lineTo(n - o / 2, m), a.stroke(), a.fillStyle = f.color, a.textAlign = "right", a.textBaseline = "top", a.fillText(b, 2 === g ? 29 : 15, k.mozilla ? 7 * g : 6 * g) }, t = function () { o().getContext && p(o().toDataURL()) }, u = function (a) { for (var b = [["G", 1e9], ["M", 1e6], ["k", 1e3]], c = 0; c < b.length; ++c)if (a >= b[c][1]) { a = v(a / b[c][1]) + b[c][0]; break } return a }, v = function (a, b) { return new Number(a).toFixed(b) }; a.setOptions = function (a) { f = {}, a.colour && (a.color = a.colour); for (var b in i) f[b] = a.hasOwnProperty(b) ? a[b] : i[b]; return this }, a.setImage = function (a) { return b = a, t(), this }, a.setBubble = function (a, b) { return a = a || "", q(a, b), this }, a.reset = function () { b = c, p(c) }, a.setOptions(i), "function" == typeof define && define.amd ? define(a) : "undefined" != typeof module ? module.exports = a : window.Tinycon = a }();