kopia lustrzana https://github.com/FacilMap/facilmap
Dereferrering external links
rodzic
8857e0631a
commit
d0e254afb8
|
@ -0,0 +1,13 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
var url = decodeURIComponent(location.search.replace(/^\?/, ""));
|
||||
if(url)
|
||||
location.replace(url);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -8,6 +8,19 @@ var FacilPad = {
|
|||
$compileProvider.aHrefSanitizationWhitelist(/^\s*(https?|ftp|mailto|javascript):/);
|
||||
} ]);
|
||||
|
||||
// Dereferrer
|
||||
$(document).on("click", "a", function(e) {
|
||||
var el = $(e.target);
|
||||
var href = el.attr("href");
|
||||
if(href && href.match(/^\s*(https?:)?\/\//i)) {
|
||||
el.attr("href", "deref.html?"+encodeURIComponent(href));
|
||||
|
||||
setTimeout(function() {
|
||||
el.attr("href", href);
|
||||
}, 0);
|
||||
}
|
||||
});
|
||||
|
||||
fp.app.run([ "$rootScope", "fpUtils", function($rootScope, fpUtils) {
|
||||
$rootScope.padId = location.pathname.match(/[^\/]*$/)[0];
|
||||
$rootScope.urlPrefix = location.protocol + "//" + location.host + location.pathname.replace(/[^\/]*$/, "");
|
||||
|
|
Ładowanie…
Reference in New Issue