💄 Rend l'alerte un peu plus belle

This commit is contained in:
2017-01-16 23:01:05 +01:00
parent 0a2da9f512
commit aa2cc5b4c2
3 changed files with 188 additions and 3 deletions

View File

@@ -3,11 +3,35 @@ ini_set("display_errors", "off");
ini_set("log_errors", "on");
ini_set('error_log', dirname(__FILE__) . '/log.log');
$config = include 'config.php';
$config = include dirname(__FILE__) . '/config.php';
// launch by bookmarklet
if (isset($_GET['v'])) {
header("Content-type: text/javascript");
echo 'function loadScript( url, callback ) {
var script = document.createElement("script");
script.type = "text/javascript";
if(script.readyState) { //IE
script.onreadystatechange = function() {
if ( script.readyState === "loaded" || script.readyState === "complete" ) {
script.onreadystatechange = null;
callback();
}
};
} else { //Others
script.onload = function() {
callback();
};
}
script.src = url;
document.head.appendChild(script);
}';
echo 'var style = document.createElement("link");
style.rel = "stylesheet";
style.type = "text/css";
style.href = "//' . $_SERVER['HTTP_HOST'].'/css/alertify.css";
document.head.appendChild(style);';
$email = isset($_GET['m']) ? $_GET['m'] : '';
$url = isset($_GET['u']) ? $_GET['u'] : '';
$title = isset($_GET['t']) ? $_GET['t'] : '';
@@ -44,7 +68,8 @@ if (isset($_GET['v'])) {
else
$mail->Body = '<hr/>' . nl2br($body) . '<hr/>';
if ($mail->send()) {
echo 'alert("Email Sent.");';
echo 'loadScript("//' . $_SERVER['HTTP_HOST'].' /js/alertify.min.js",
function() { alertify.alert("Email Sent."); });';
} else {
echo ':(';
}
@@ -73,7 +98,7 @@ if (isset($_GET['v'])) {
if ($_POST['html'] == 'on') { // bookmarklet pour l'envoi en HTML
$include = '<a href="javascript:void((function(){if(typeof(jQuery)!=\'function\'){var%20n=document.createElement(\'script\');n.setAttribute(\'src\',\'//ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js\');document.getElementsByTagName(\'head\')[0].appendChild(n);}function%20v(){if(typeof(jQuery)==\'function\'){clearInterval(i);c();}}var%20i=window.setInterval(v,100);function%20c(){q=\'\';function%20gx(el){el=el.get(0);xp=\'\';for(;el&&el.nodeType==1;el=el.parentNode){id=jQuery(el.parentNode).children(el.tagName).index(el)+1;id>1?(id=\'[\'+id+\']\'):(id=\'\');xp=\'/\'+el.tagName.toLowerCase()+id+xp;}return%20xp;}jQuery(\'*\').bind(\'mouseenter\',function(){jQuery(\'*\').removeClass(\'shikihover\');jQuery(\'*\').css(\'border\',\'\');jQuery(this).css(\'border\',\'3px%20solid%20yellow\');jQuery(this).addClass(\'shikihover\');});jQuery(\'.shikihover\').live(\'click\',function(){jQuery(\'*\').unbind(\'mouseenter\').removeClass(\'shikihover\');jQuery(this).css(\'border\',\'\');var%20q=\'&q=\'+gx(jQuery(this)),d=document,t=d.title,f=\'//' . $_SERVER['HTTP_HOST'] . substr($_SERVER[PHP_SELF], 0, -9) . '\',m=\'' . $_POST['email'] . '\',l=d.location,e=encodeURIComponent,p=\'?v=1&u=\'+e(l.href)+\'&t=\'+e(t)+\'&m=\'+e(m),u=f+p+q;newScript=d.createElement(\'script\');newScript.type=\'text/javascript\';newScript.src=u;d.body.appendChild(newScript);});}})())">Bookmark by email</a>';
} else { // bookmarklet pour l'envoi normal
$include = "<a href='javascript:var%20d=document,t=d.title,f=\"//" . $_SERVER['HTTP_HOST'] . substr($_SERVER[PHP_SELF], 0, -9) . "\",m=\"" . $_POST['email'] . "\",l=d.location,e=encodeURIComponent,p=\"?v=1&u=\"+e(l.href)+\"&t=\"+e(t)+\"&m=\"+e(m),u=f+p;var%20ns=document.createElement(\"script\");ns.type=\"text/javascript\";ns.src=u;document.body.appendChild(ns);void(0)'>Bookmark by email</a>";
$include = "<a href='javascript:var%20d=document,t=d.title,f=\"//" . $_SERVER['HTTP_HOST'] . substr($_SERVER['PHP_SELF'], 0, -9) . "\",m=\"" . $_POST['email'] . "\",l=d.location,e=encodeURIComponent,p=\"?v=1&u=\"+e(l.href)+\"&t=\"+e(t)+\"&m=\"+e(m),u=f+p;var%20ns=document.createElement(\"script\");ns.type=\"text/javascript\";ns.src=u;document.body.appendChild(ns);void(0)'>Bookmark by email</a>";
}
//ADDING STATS