@react-google-maps/api
Advanced tools
Comparing version 1.2.0-alpha.10 to 1.2.0-alpha.11
@@ -23,3 +23,6 @@ "use strict"; | ||
document.head.appendChild(script); | ||
}) | ||
.catch(function (err) { | ||
console.error('injectScript error: ', err); | ||
}); | ||
}; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var isRobotoStyle = function (element) { | ||
if (element.href && | ||
element.href.indexOf("https://fonts.googleapis.com/css?family=Roboto") === 0) { | ||
return true; | ||
} | ||
if (element.tagName.toLowerCase() === "style" && | ||
element.styleSheet && | ||
element.styleSheet.cssText && | ||
element.styleSheet.cssText.replace("\r\n", "").indexOf(".gm-style") === 0) { | ||
element.styleSheet.cssText = ""; | ||
return true; | ||
} | ||
if (element.tagName.toLowerCase() === "style" && | ||
element.innerHTML && | ||
element.innerHTML.replace("\r\n", "").indexOf(".gm-style") === 0) { | ||
element.innerHTML = ""; | ||
return true; | ||
} | ||
if (element.tagName.toLowerCase() === "style" && | ||
!element.styleSheet && | ||
!element.innerHTML) { | ||
return true; | ||
} | ||
return false; | ||
}; | ||
exports.preventGoogleFonts = function () { | ||
var isRobotoStyle = function (element) { | ||
if (element.href && | ||
element.href.indexOf("https://fonts.googleapis.com/css?family=Roboto") === 0) { | ||
return true; | ||
} | ||
if (element.tagName.toLowerCase() === "style" && | ||
element.styleSheet && | ||
element.styleSheet.cssText && | ||
element.styleSheet.cssText.replace("\r\n", "").indexOf(".gm-style") === 0) { | ||
element.styleSheet.cssText = ""; | ||
return true; | ||
} | ||
if (element.tagName.toLowerCase() === "style" && | ||
element.innerHTML && | ||
element.innerHTML.replace("\r\n", "").indexOf(".gm-style") === 0) { | ||
element.innerHTML = ""; | ||
return true; | ||
} | ||
if (element.tagName.toLowerCase() === "style" && | ||
!element.styleSheet && | ||
!element.innerHTML) { | ||
return true; | ||
} | ||
return false; | ||
}; | ||
console.log('preventGoogleFonts run'); | ||
var head = document.getElementsByTagName("head")[0]; | ||
var trueInsertBefore = head.insertBefore.bind(head); | ||
head.insertBefore = function insertBefore(newElement, referenceElement) { | ||
if (!isRobotoStyle(newElement)) { | ||
Reflect.apply(head.insertBefore, head, [newElement, referenceElement]); | ||
Reflect.apply(trueInsertBefore, head, [newElement, referenceElement]); | ||
} | ||
}; | ||
var trueAppend = head.appendChild.bind(head); | ||
head.appendChild = function appendChild(textNode) { | ||
if (!isRobotoStyle(textNode)) { | ||
Reflect.apply(head.appendChild, head, [textNode]); | ||
Reflect.apply(trueAppend, head, [textNode]); | ||
} | ||
}; | ||
}; |
{ | ||
"name": "@react-google-maps/api", | ||
"version": "1.2.0-alpha.10", | ||
"version": "1.2.0-alpha.11", | ||
"description": "React.js Google Maps API integration", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
333064
7398