{"version":3,"file":"browser-update.js","names":["$bu","navigator","userAgent","ua","indexOf","window","unsupportedBrowser","document","getElementsByTagName","className","noscriptElements","i","length","element","result","j","childNodes","nodeValue","getAttribute","getElementById","outerHTML","t","I18n","div","createElement","innerHTML","sheet","style","body","appendChild","innerText","e","styleSheet","cssText","ex","marginTop","clientHeight","$buo"],"sources":["scripts/browser-update.js"],"sourcesContent":["//browser-update.org notification script, <browser-update.org>\n//Copyright (c) 2007-2009, MIT Style License <browser-update.org/LICENSE.txt>\n\n/* eslint-disable no-var */\n\n(function () {\n  var $buo = function () {\n    // Sometimes we have to resort to parsing the user agent string. :(\n    if (navigator && navigator.userAgent) {\n      var ua = navigator.userAgent;\n\n      // we don't ask Googlebot to update their browser\n      if (ua.indexOf(\"Googlebot\") >= 0 || ua.indexOf(\"Mediapartners\") >= 0 || ua.indexOf(\"AdsBot\") >= 0) {\n        return;\n      }\n    }\n    if (!window.unsupportedBrowser) {\n      return;\n    }\n    document.getElementsByTagName(\"body\")[0].className += \" crawler\";\n    var noscriptElements = document.getElementsByTagName(\"noscript\");\n    // find the element with the \"data-path\" attribute set\n    for (var i = noscriptElements.length - 1; i >= 0; i--) {\n      var element = noscriptElements[i];\n\n      // noscriptElements[i].innerHTML contains encoded HTML, so we need to access\n      // the childNodes instead. Browsers seem to split very long content into multiple\n      // text childNodes.\n      var result = \"\";\n      for (var j = 0; j < element.childNodes.length; j++) {\n        result += element.childNodes[j].nodeValue;\n      }\n      if (element.getAttribute(\"data-path\")) {\n        document.getElementById(\"main\").outerHTML = result;\n      } else {\n        element.outerHTML = result;\n      }\n    }\n\n    // retrieve localized browser upgrade text\n    var t = window.I18n && I18n.t(\"browser_update\"); // eslint-disable-line no-undef\n    if (!t || t.indexOf(\".browser_update]\") !== -1) {\n      // very old browsers might fail to load even translations\n      t = 'Unfortunately, <a href=\"https://www.discourse.org/faq/#browser\">your browser is unsupported</a>. Please <a href=\"https://browsehappy.com\">switch to a supported browser</a> to view rich content, log in and reply.';\n    }\n\n    // create the notification div HTML\n    var div = document.createElement(\"div\");\n    div.className = \"buorg\";\n    div.innerHTML = \"<div>\" + t + \"</div>\";\n\n    // create the notification div stylesheet\n    var sheet = document.createElement(\"style\");\n    var style = \".buorg {position:absolute; z-index:111111; width:100%; top:0px; left:0px; background:#FDF2AB; text-align:left; font-family: sans-serif; color:#000; font-size: 14px;} .buorg div {padding: 8px;} .buorg a, .buorg a:visited {color:#E25600; text-decoration: underline;} @media print { .buorg { display: none !important; } }\";\n\n    // insert the div and stylesheet into the DOM\n    document.body.appendChild(div); // put it last in the DOM so Googlebot doesn't include it in search excerpts\n    document.getElementsByTagName(\"head\")[0].appendChild(sheet);\n    try {\n      sheet.innerText = style;\n      sheet.innerHTML = style;\n    } catch (e) {\n      try {\n        sheet.styleSheet.cssText = style;\n      } catch (ex) {\n        return;\n      }\n    }\n\n    // shift the body down to make room for our notification div\n    document.body.style.marginTop = div.clientHeight + \"px\";\n  };\n  $bu = $buo(); // eslint-disable-line no-undef\n})(this);\n"],"mappings":"AAwEAA,IAlEA,WAEA,GAAAC,qBAAAC,UAAA,CACA,IAAAC,EAAAF,UAAAC;AAGA,GAAAC,EAAAC,QAAA,iBAAAD,EAAAC,QAAA,qBAAAD,EAAAC,QAAA,aACA,MAEA,CACA,GAAAC,OAAAC,mBAAA,CAGAC,SAAAC,qBAAA,WAAAC,WAAA;AAGA,IAFA,IAAAC,EAAAH,SAAAC,qBAAA,YAEAG,EAAAD,EAAAE,OAAA,EAAAD,GAAA,EAAAA,IAAA,CAOA,IANA,IAAAE,EAAAH,EAAAC,GAKAG,EAAA,GACAC,EAAA,EAAAA,EAAAF,EAAAG,WAAAJ,OAAAG,IACAD,GAAAD,EAAAG,WAAAD,GAAAE;AAEAJ,EAAAK,aAAA,aACAX,SAAAY,eAAA,QAAAC,UAAAN,EAEAD,EAAAO,UAAAN,CAEA,CAGA,IAAAO,EAAAhB,OAAAiB,WAAAD,EAAA;AACAA,IAAA,IAAAA,EAAAjB,QAAA,sBAEAiB,EAAA;AAIA,IAAAE,EAAAhB,SAAAiB,cAAA;AACAD,EAAAd,UAAA,QACAc,EAAAE,UAAA,QAAAJ,EAAA;AAGA,IAAAK,EAAAnB,SAAAiB,cAAA,SACAG,EAAA;AAGApB,SAAAqB,KAAAC,YAAAN,GACAhB,SAAAC,qBAAA,WAAAqB,YAAAH;AACA,IACAA,EAAAI,UAAAH,EACAD,EAAAD,UAAAE,CACA,OAAAI,GACA,IACAL,EAAAM,WAAAC,QAAAN,CACA,OAAAO,GACA,MACA,CACA,CAGA3B,SAAAqB,KAAAD,MAAAQ,UAAAZ,EAAAa,aAAA,IApDA,CAqDA,CACAC"}