diff --git a/public/js/widgets.js b/public/js/widgets.js new file mode 100644 index 0000000000000000000000000000000000000000..8bdd806164b9de29c72d0ec7707dd2edf94e0535 --- /dev/null +++ b/public/js/widgets.js @@ -0,0 +1,16 @@ +function copyCode() { + $("#codesnippet").select(); + try { + var successful = document.execCommand('copy'); + if (successful) { + $('#copyButton').removeClass('btn-default'); + $('#copyButton').addClass('btn-success'); + } else { + $('#copyButton').removeClass('btn-default'); + $('#copyButton').addClass('btn-danger'); + } + } catch (err) { + $('#copyButton').removeClass('btn-default'); + $('#copyButton').addClass('btn-danger'); + } +} \ No newline at end of file diff --git a/resources/views/widget/sitesearch.blade.php b/resources/views/widget/sitesearch.blade.php index d9660fb8863b12fb2171570941a1b55853067456..624fff8e2557c7949993d10f56d63905687458ec 100644 --- a/resources/views/widget/sitesearch.blade.php +++ b/resources/views/widget/sitesearch.blade.php @@ -3,20 +3,7 @@ @section('title', $title ) @section('content') -<script type="text/javascript"> - function copyCode() { - $("#codesnippet").select(); - try { - var successful = document.execCommand('copy'); - if( successful ) - alert('{{ trans('websearch.alert.success') }}'); - else - alert('{{ trans('websearch.alert.failure') }}'); - } catch (err) { - alert('{{ trans('websearch.alert.failure') }}'); - } - } -</script> +<script type="text/javascript" src="/js/widgets.js"></script> <h1>{{ trans('sitesearch.head.1') }}</h1> <p>{{ trans('sitesearch.head.2') }}</p> <h2>{{ trans('sitesearch.head.3') }}</h2> @@ -33,7 +20,7 @@ <input type="hidden" name="encoding" value="utf8"> <input type="hidden" name="site" value="{{ $site }}"> </form> -<h2>{{ trans('sitesearch.generated.5') }} <button class="btn btn-default" type="submit" onclick="copyCode()"><span class="glyphicon glyphicon-paperclip" aria-hidden="true"></span> {{ trans('websearch.head.copy') }}</button></h2> +<h2>{{ trans('sitesearch.generated.5') }} <button id="copyButton" class="btn btn-default" type="submit" onclick="copyCode()"><span class="glyphicon glyphicon-paperclip" aria-hidden="true"></span> {{ trans('websearch.head.copy') }}</button></h2> <textarea id="codesnippet" readonly style="width:100%;height:500px"><form class="metager-searchform" action="{{ LaravelLocalization::getLocalizedURL(LaravelLocalization::getCurrentLocale(), "/") }}/meta/meta.ger3" method="get" accept-charset="UTF-8" > <style type="text/css" scoped> .metager-searchinput { diff --git a/resources/views/widget/websearch.blade.php b/resources/views/widget/websearch.blade.php index b743ed22c20f2124d0c9be295761207d45ba1a8b..1def7a33b3c16525e9f21034a1fb76b2f23f5267 100644 --- a/resources/views/widget/websearch.blade.php +++ b/resources/views/widget/websearch.blade.php @@ -3,20 +3,7 @@ @section('title', $title ) @section('content') -<script type="text/javascript"> - function copyCode() { - $("#codesnippet").select(); - try { - var successful = document.execCommand('copy'); - if( successful ) - alert('{{ trans('websearch.alert.success') }}'); - else - alert('{{ trans('websearch.alert.failure') }}'); - } catch (err) { - alert('{{ trans('websearch.alert.failure') }}'); - } - } -</script> +<script type="text/javascript" src="/js/widgets.js"></script> <h1>{{ trans('websearch.head.1') }}</h1> <p>{{ trans('websearch.head.2') }}</p> <h2>{{ trans('websearch.head.3') }}</h2> @@ -24,7 +11,7 @@ <a href="{{ LaravelLocalization::getLocalizedURL(LaravelLocalization::getCurrentLocale(), "/") }}"> <img class="metager-logo" title="{{ trans('websearch.head.4') }}" alt="MetaGer" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAN8AAABGAgMAAAAx/qk0AAAADFBMVEX/wmn/3KL/6Mj+/vtPnQnhAAAC10lEQVRIx+2XMa7TQBCG1zaJkYwUGp5E5RbR+AJI9g2gQLQ0vDpHsMUJKB49DRIKBRdAco6wN8AFB7CQkfzEZod/Zu3ENgSkbRBStnDkt/uNZ/6ZnX2r6KvyGFujyIdTkVG9F6g+q9YPfKL2fuA9VfmBd1XhB95Rl3EZl/Evxur62dm5gAg7uqSxA613pw2+JqI358CQCD2EqBneEzr1ohLg4WyfJKwMT+CGqonNP4NaxfwYwaOrm7+DGzo6mJ5AeLojcw6M2ctMwNU13jM+GYIXzxUHrtWawQc3TsdXUzAhCJqzQkFNnbjXc3AavljMPxJxNdTvtrOvY2UH2wBhwgrYxUzjfThdMn4L6Rv1c/BTF9AXRMbiVykeLUyIjWbMNN5C+oEvzMCXfURbknnS2QgSPrQfVUCRROzKFEzpqUlsTgipj6l9THb3bnODzxf5oC++nNKewdn5ltHGpCZnz3QIm7Xhc4WzUg4nLwwkpGO4e38K5pQc8g5gCn1Yp36sg9qy+50qLbzRydxRgDa2dVseYEHNQVGE/2Ic2CxBrh04CMOgAjG8ZTlQbZhqA5iKqNnQ4iAuD5itANYsHjLTSlFA1QGUUic9KX43ahPyIqNkvgsZLEcw/EhN5MBJDY9ggBVwx4ERQMmoVVxx0QRcFDkjEpnMt1iJ1bcqhzHi5GsH7rPfgW14lDOS3akROoIuuB9ETs6cli0HOdccmQMZ4u6BoEv8TEC7bDmtKiuOjEtmXQxgCDCXXVaJXA/Z919A0YCrc1UDtB+Qa95SGTcAqli7qwP7vugc7eBgLjnAVjCSxs5lE3Hy04hDc7CRNqBda+KUY5eRBegyr8SiUcvmE0t7YzkiSZ6SIqDv7AjX0q1rdr2ixT+biYBSiLW07Yz3A70eKs8W0l7xs9wc08wcD4qV62rq6r2U2eptcTlGL+O/HN4XFu8rkvelzPsa6H3x9L7q+l6ufwK7PWV5kEbECQAAAABJRU5ErkJggg=="></a><input class="metager-searchinput" name="eingabe" placeholder="{{ trans('websearch.head.5') }}" required=""><input type="hidden" name="lang" value="{{ trans('websearch.head.6') }}"><input type="hidden" name="encoding" value="utf8"><button class="metager-searchbutton" type="submit">{{ trans('websearch.head.8') }}</button> </form> -<h2>{{ trans('websearch.head.7') }} <button class="btn btn-default" type="submit" onclick="copyCode()"><span class="glyphicon glyphicon-paperclip" aria-hidden="true"></span> {{ trans('websearch.head.copy') }}</button></h2> +<h2>{{ trans('websearch.head.7') }} <button id="copyButton" class="btn btn-default" type="submit" onclick="copyCode()"><span class="glyphicon glyphicon-paperclip" aria-hidden="true"></span> {{ trans('websearch.head.copy') }}</button></h2> <textarea id="codesnippet" readonly style="width:100%;height:500px"><form class="metager-searchform" action="{{ LaravelLocalization::getLocalizedURL(LaravelLocalization::getCurrentLocale(), "/") }}/meta/meta.ger3" method="get" accept-charset="UTF-8" > <style type="text/css" scoped> .metager-searchinput {