diff --git a/libraries/functions-front.js b/libraries/functions-front.js new file mode 100644 index 0000000..7c93a6a --- /dev/null +++ b/libraries/functions-front.js @@ -0,0 +1,27 @@ +var user_agent = navigator.userAgent.toLowerCase(); +var click_event = user_agent.match(/(iphone|ipod|ipad)/) ? "touchend" : "click"; +var windowsize = $(window).width(); + +$( function() +{ + function hasWebP() { + var rv = $.Deferred(), img = new Image(); + img.onload = function() { rv.resolve(); }; + img.onerror = function() { rv.reject(); }; + img.src = "/libraries/webp.webp"; + return rv.promise(); + } + + hasWebP().then(function() { + }, function() { + $('body').addClass('nowebp'); + $( 'img' ).each( function() + { + if ( $( this ).attr( 'src-nowebp' ) ) + { + $( this ).attr( 'src', $( this ).attr( 'src-nowebp' ) ); + $( this ).attr( 'data-src', $( this ).attr( 'src-nowebp' ) ); + } + }); + }); +}); \ No newline at end of file diff --git a/templates_user/articles/article-full.php b/templates_user/articles/article-full.php index d332f2f..da412e3 100644 --- a/templates_user/articles/article-full.php +++ b/templates_user/articles/article-full.php @@ -194,6 +194,7 @@ buttons : {} } }); + $(function () { $(".article-21 .nav-tabs li:nth-child(2)").find('a').trigger("click"); }) diff --git a/templates_user/articles/article.php b/templates_user/articles/article.php index 063a893..1eb18dd 100644 --- a/templates_user/articles/article.php +++ b/templates_user/articles/article.php @@ -140,6 +140,7 @@ $text = $before . $out; } } + $dom = new DomDocument('1.0', 'UTF-8'); $dom -> loadHTML( '' . "\n" . $text ); $elements = $dom -> getElementsByTagName( 'img' );