From 6f8fda303aeed6013f68e2c7897463e69307b0e3 Mon Sep 17 00:00:00 2001 From: daniel bannert Date: Sun, 8 Nov 2015 13:02:34 +0100 Subject: [PATCH] replaced ZeroClipboard with clipboard | fixes #313 --- src/Whoops/Handler/PrettyPageHandler.php | 2 + src/Whoops/Resources/css/whoops.base.css | 56 +++++++++++++++++++++- src/Whoops/Resources/js/clipboard.min.js | 7 +++ src/Whoops/Resources/js/whoops.base.js | 43 ++++++++++++----- src/Whoops/Resources/views/header.html.php | 2 +- src/Whoops/Resources/views/layout.html.php | 2 +- 6 files changed, 98 insertions(+), 14 deletions(-) create mode 100644 src/Whoops/Resources/js/clipboard.min.js diff --git a/src/Whoops/Handler/PrettyPageHandler.php b/src/Whoops/Handler/PrettyPageHandler.php index 9e436d7..0fa940c 100644 --- a/src/Whoops/Handler/PrettyPageHandler.php +++ b/src/Whoops/Handler/PrettyPageHandler.php @@ -120,6 +120,7 @@ class PrettyPageHandler extends Handler $templateFile = $this->getResource("views/layout.html.php"); $cssFile = $this->getResource("css/whoops.base.css"); $zeptoFile = $this->getResource("js/zepto.min.js"); + $clipboard = $this->getResource("js/clipboard.min.js"); $jsFile = $this->getResource("js/whoops.base.js"); if ($this->customCss) { @@ -143,6 +144,7 @@ class PrettyPageHandler extends Handler // @todo: Asset compiler "stylesheet" => file_get_contents($cssFile), "zepto" => file_get_contents($zeptoFile), + "clipboard" => file_get_contents($clipboard), "javascript" => file_get_contents($jsFile), // Template paths: diff --git a/src/Whoops/Resources/css/whoops.base.css b/src/Whoops/Resources/css/whoops.base.css index 251c1ca..34f18ff 100644 --- a/src/Whoops/Resources/css/whoops.base.css +++ b/src/Whoops/Resources/css/whoops.base.css @@ -340,7 +340,6 @@ pre.prettyprint, code.prettyprint { } #copy-button { - display: none; float: right; cursor: pointer; border: 0; @@ -469,3 +468,58 @@ kbd { width: 32%; } } + +.tooltipped { + position: relative +} +.tooltipped:after { + position: absolute; + z-index: 1000000; + display: none; + padding: 5px 8px; + color: #fff; + text-align: center; + text-decoration: none; + text-shadow: none; + text-transform: none; + letter-spacing: normal; + word-wrap: break-word; + white-space: pre; + pointer-events: none; + content: attr(aria-label); + background: rgba(0, 0, 0, 0.8); + border-radius: 3px; + -webkit-font-smoothing: subpixel-antialiased +} +.tooltipped:before { + position: absolute; + z-index: 1000001; + display: none; + width: 0; + height: 0; + color: rgba(0, 0, 0, 0.8); + pointer-events: none; + content: ""; + border: 5px solid transparent +} +.tooltipped:hover:before, +.tooltipped:hover:after, +.tooltipped:active:before, +.tooltipped:active:after, +.tooltipped:focus:before, +.tooltipped:focus:after { + display: inline-block; + text-decoration: none +} +.tooltipped-s:after { + top: 100%; + right: 50%; + margin-top: 5px +} +.tooltipped-s:before { + top: auto; + right: 50%; + bottom: -5px; + margin-right: -5px; + border-bottom-color: rgba(0, 0, 0, 0.8) +} \ No newline at end of file diff --git a/src/Whoops/Resources/js/clipboard.min.js b/src/Whoops/Resources/js/clipboard.min.js new file mode 100644 index 0000000..36a75a4 --- /dev/null +++ b/src/Whoops/Resources/js/clipboard.min.js @@ -0,0 +1,7 @@ +/*! + * clipboard.js v1.5.3 + * https://zenorocha.github.io/clipboard.js + * + * Licensed MIT © Zeno Rocha + */ +!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,e.Clipboard=t()}}(function(){var t,e,n;return function t(e,n,r){function o(a,c){if(!n[a]){if(!e[a]){var s="function"==typeof require&&require;if(!c&&s)return s(a,!0);if(i)return i(a,!0);var u=new Error("Cannot find module '"+a+"'");throw u.code="MODULE_NOT_FOUND",u}var l=n[a]={exports:{}};e[a][0].call(l.exports,function(t){var n=e[a][1][t];return o(n?n:t)},l,l.exports,t,e,n,r)}return n[a].exports}for(var i="function"==typeof require&&require,a=0;ar;r++)n[r].fn.apply(n[r].ctx,e);return this},off:function(t,e){var n=this.e||(this.e={}),r=n[t],o=[];if(r&&e)for(var i=0,a=r.length;a>i;i++)r[i].fn!==e&&r[i].fn._!==e&&o.push(r[i]);return o.length?n[t]=o:delete n[t],this}},e.exports=r},{}],8:[function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}n.__esModule=!0;var i=function(){function t(t,e){for(var n=0;n - escape($plain_exception) ?> +

diff --git a/src/Whoops/Resources/views/layout.html.php b/src/Whoops/Resources/views/layout.html.php index af61da2..b08d349 100644 --- a/src/Whoops/Resources/views/layout.html.php +++ b/src/Whoops/Resources/views/layout.html.php @@ -35,9 +35,9 @@ - +