put all embeded javascript code in seperated files
This commit is contained in:
parent
494ce4f460
commit
4f44e8f131
46
index.html
46
index.html
|
@ -6,50 +6,8 @@
|
|||
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.2/css/all.css" integrity="sha384-fnmOCqbTlWIlj8LyTjo7mOUStjsKC4pOpQbqyi7RrhN7udi9RwhKkMHpvLbHG9Sr" crossorigin="anonymous">
|
||||
<script src="js/jquery-3.3.1.min.js"></script>
|
||||
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
$("#searchfield-global").focus(function(){
|
||||
$( ".search-filter-quick" ).slideDown( "slow", function() {});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<script>
|
||||
$(function(){
|
||||
jQuery('img.svg').each(function(){
|
||||
var $img = jQuery(this);
|
||||
var imgID = $img.attr('id');
|
||||
var imgClass = $img.attr('class');
|
||||
var imgURL = $img.attr('src');
|
||||
|
||||
jQuery.get(imgURL, function(data) {
|
||||
// Get the SVG tag, ignore the rest
|
||||
var $svg = jQuery(data).find('svg');
|
||||
|
||||
// Add replaced image's ID to the new SVG
|
||||
if(typeof imgID !== 'undefined') {
|
||||
$svg = $svg.attr('id', imgID);
|
||||
}
|
||||
// Add replaced image's classes to the new SVG
|
||||
if(typeof imgClass !== 'undefined') {
|
||||
$svg = $svg.attr('class', imgClass+' replaced-svg');
|
||||
}
|
||||
|
||||
// Remove any invalid XML tags as per http://validator.w3.org
|
||||
$svg = $svg.removeAttr('xmlns:a');
|
||||
|
||||
// Check if the viewport is set, else we gonna set it if we can.
|
||||
if(!$svg.attr('viewBox') && $svg.attr('height') && $svg.attr('width')) {
|
||||
$svg.attr('viewBox', '0 0 ' + $svg.attr('height') + ' ' + $svg.attr('width'))
|
||||
}
|
||||
|
||||
// Replace image with new SVG
|
||||
$img.replaceWith($svg);
|
||||
|
||||
}, 'xml');
|
||||
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<script src="js/searchfield-focus-show-filter.js"></script>
|
||||
<script src="js/img-svg-color.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="header-black">
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
$(function(){
|
||||
jQuery('img.svg').each(function(){
|
||||
var $img = jQuery(this);
|
||||
var imgID = $img.attr('id');
|
||||
var imgClass = $img.attr('class');
|
||||
var imgURL = $img.attr('src');
|
||||
|
||||
jQuery.get(imgURL, function(data) {
|
||||
// Get the SVG tag, ignore the rest
|
||||
var $svg = jQuery(data).find('svg');
|
||||
|
||||
// Add replaced image's ID to the new SVG
|
||||
if(typeof imgID !== 'undefined') {
|
||||
$svg = $svg.attr('id', imgID);
|
||||
}
|
||||
// Add replaced image's classes to the new SVG
|
||||
if(typeof imgClass !== 'undefined') {
|
||||
$svg = $svg.attr('class', imgClass+' replaced-svg');
|
||||
}
|
||||
|
||||
// Remove any invalid XML tags as per http://validator.w3.org
|
||||
$svg = $svg.removeAttr('xmlns:a');
|
||||
|
||||
// Check if the viewport is set, else we gonna set it if we can.
|
||||
if(!$svg.attr('viewBox') && $svg.attr('height') && $svg.attr('width')) {
|
||||
$svg.attr('viewBox', '0 0 ' + $svg.attr('height') + ' ' + $svg.attr('width'))
|
||||
}
|
||||
|
||||
// Replace image with new SVG
|
||||
$img.replaceWith($svg);
|
||||
|
||||
}, 'xml');
|
||||
|
||||
});
|
||||
});
|
|
@ -0,0 +1,5 @@
|
|||
$(document).ready(function(){
|
||||
$("#searchfield-global").focus(function(){
|
||||
$( ".search-filter-quick" ).slideDown( "slow", function() {});
|
||||
});
|
||||
});
|
Loading…
Reference in New Issue