//Bookmarklet - signapplet : obtenir les meta-donnees directement et les en-tetes HTTP via Ajax /* Interfacteur 2013 - 2014 pour la version mixte IE */ //javascript:"use%20strict";if(document.location.protocol.indexOf("https")==0){void(alert("Le%20protocole%20https%20n'est%20pas%20pris%20en%20charge"))}else{var%20bookmarkletDonneesReglages=false;void((function(){if(typeof%20bookmarkletDonnees!=="undefined"&&bookmarkletDonnees.actif){bookmarkletDonnees.agir();}else{if(document.getElementById("bookmarkletDonnees")){document.getElementsByTagName("body")[0].removeChild(document.getElementById("bookmarkletDonnees"));}var%20loadscript=document.createElement("script");loadscript.id="bookmarkletDonnees";loadscript.src="http://etc/signapplet-donnees.js?t="+new%20Date().getTime();document.getElementsByTagName("body")[0].appendChild(loadscript);}})());} "use strict"; var bookmarkletDonnees = {}; document.getElementsByTagName("body")[0].removeChild(document.getElementById("bookmarkletDonnees")); (bookmarkletDonnees.agir = function(){ var msie = 0 /*@cc_on + parseInt(navigator.userAgent.toLowerCase().split("msie")[1]) @*/; var limitant = 1 / (msie - 1); function delimiter(zv){ //indiquer les version de IE inferieures a zv return limitant > (1 / (parseInt(zv) - 1)); } if (delimiter(8)) return alert("Navigateur insuffisant, d\xE9sol\xE9 de ne pouvoir vous donner satisfaction."); //lt IE 8 var saut = delimiter(10) ? "" : "\n"; //lt IE 10 var normes = Math.ceil(Math.abs(msie - 8) / (Math.abs(msie - 8) + 1)); //pour IE 8 : 0 var detecter = [ function(){ //IE 8 : http://msdn.microsoft.com/en-us/library/ff460561%28v=vs.85%29.aspx : Quirks Mode, IE7 Mode, and IE8 Mode (All Versions) The following attributes of the Document interface are not supported: inputEncoding d'ou http://msdn.microsoft.com/en-us/library/ms533553%28v=vs.85%29.aspx return document.charset; }, function(){ return typeof document.characterSet !== "undefined" ? document.characterSet : document.inputEncoding; }]; var opacites = ["filter","opacity"]; var entenuation = [ //ce n'est pas la bonne methode cf. http://www.google.fr/advanced_search?hl=fr function(zel,opa) { zel.style.filter = "alpha(opacity=" + parseInt(opa) * 10 + ");"; }, function(zel,opa) { zel.style.opacity = parseInt(opa) / 10; }]; var extraire = [ function(zi){ //attention suppose que l'opacite IE 8 est reglee par filter: alpha(opacity=n); var opaque = window.getComputedStyle(bookmarkletDonnees.racines[zi],null).getPropertyValue(opacites[0]); return (/alpha\(opacity/).test(opaque) ? parseInt((/\d+(\.\d+)?/).exec(opaque)[0]) / 10 : 10; }, function(zi){ return window.getComputedStyle(bookmarkletDonnees.racines[zi],null).getPropertyValue(opacites[1]) * 10; } ]; var cssie = delimiter(21) ? "behavior: none!important;" : ""; var cssie8 = ["background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyBpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMC1jMDYwIDYxLjEzNDc3NywgMjAxMC8wMi8xMi0xNzozMjowMCAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNSBXaW5kb3dzIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOjUyMTM3ODU5N0M2MzExRTM4MTU1RTM4MzRFOEVGMTBEIiB4bXBNTTpEb2N1bWVudElEPSJ4bXAuZGlkOjUyMTM3ODVBN0M2MzExRTM4MTU1RTM4MzRFOEVGMTBEIj4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6NTIxMzc4NTc3QzYzMTFFMzgxNTVFMzgzNEU4RUYxMEQiIHN0UmVmOmRvY3VtZW50SUQ9InhtcC5kaWQ6NTIxMzc4NTg3QzYzMTFFMzgxNTVFMzgzNEU4RUYxMEQiLz4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz6utP3xAAAAEElEQVR42mL8////M4AAAwAJ5wPlyVw2ZAAAAABJRU5ErkJggg==)!important; filter: alpha(opacity=100)!important; "]; cssie8.push("background: rgba(255,255,255,.9)!important; opacity: 1!important; "); var cssprefixes = ["-webkit-animation: none!important; -moz-animation: none!important; -o-animation: none!important; animation: none!important; -webkit-transform: none!important; -moz-transform: none!important; -o-transform: none!important; transform: none!important; "]; cssprefixes[8] = ""; cssprefixes[9] = "-ms-transform: none!important; "; for (var i = 10;i<21;i++) cssprefixes[i] = "animation: none!important; transform: none!important; "; var chargement = typeof document.onload === "object" ? function(suivre){ this.onload = function(){ suivre(this); } } : function(suivre){ this.onreadystatechange = function(){ if (this.readyState == 4){ if (this.status == 200 || this.status == 0){ suivre(this); } } } } if (! window.getComputedStyle){ // IE 8 cf. http://snipplr.com/view/13523/ window.getComputedStyle = function(el, pseudo){ this.el = el; this.getPropertyValue = function(prop){ var re = /(\-([a-z]){1})/g; if (prop == "float") prop = "styleFloat"; if (re.test(prop)){ prop = prop.replace(re,function(){ return arguments[2].toUpperCase(); }); } return el.currentStyle[prop] ? el.currentStyle[prop] : null; } return this; } } var inscrire = document.body.textContent ? function(texte){ this.textContent = texte; } : function(texte){ try{ this.appendChild(document.createTextNode(texte)); } //vieux navigateurs sauf IE pour la creation de styles catch(e){ this.styleSheet.cssText = texte; } //IE faisant vraiment son IE http://www.phpied.com/dynamic-script-and-style-elements-in-ie/ } /* */ Number.prototype.dizer = function(){ return this.toString().length == 1 ? "0" + this : this; } if(document.getElementById("presentationGetAllResponseHeaders")){ document.body.removeChild(document.getElementById("presentationGetAllResponseHeaders")); } ! bookmarkletDonnees.actif && (function(){ bookmarkletDonnees.initial = new Date(); bookmarkletDonnees.modification = "\u25D8\u0020Derni\xE8re modification : " + document.lastModified + "\n"; var charset = "\u25D8\u0020Encodage : "; bookmarkletDonnees.methode = delimiter(21) ? "GET" : "HEAD"; //preventivement pour IE ou detection positive du charset peut tenir d'une reconstrction (DOM au chargement ?) try{ charset += document.querySelector("meta[http-equiv='Content-Type']").getAttribute("content").split("=")[1] + " via meta HTML 4\n"; } catch(e){ try{ charset += document.querySelector("meta[charset]").getAttribute("charset") + " via meta HTML 5\n"; } catch(e){ charset += detecter[normes]() + " non declar\xE9\n"; //conserver ce message pour IE 8 cf. etude du code source pour valider charset bookmarkletDonnees.methode = normes > 0 ? "HEAD" : bookmarkletDonnees.methode; //IE 8 : besoin du code source pour le doctype } } bookmarkletDonnees.charset = charset; var dodo = document.doctype; //http://stackoverflow.com/questions/6088972/get-doctype-of-an-html-as-string-with-javascript var docMessage = ["sur MSIE 8, m\xE9thode indisponible","non declar\xE9 ou m\xE9thode indisponible"]; bookmarkletDonnees.typedoc = "\u25D8\u0020Doctype : " + (dodo === null ? docMessage[normes] : "') + "\n"; normes > 0 && (function(){ bookmarkletDonnees.racines = document.querySelectorAll("body > *"); bookmarkletDonnees.course = bookmarkletDonnees.racines.length; })(); normes == 0 && (function(){ bookmarkletDonnees.racines = document.body.children; bookmarkletDonnees.course = bookmarkletDonnees.racines.length - 1; })(); bookmarkletDonnees.stylesOpacite = []; for (var i = 0;i -1; bookmarkletDonnees.afficher = function(ajax){ var presentationPseudo = document.createElement("style"); presentationPseudo.id = "presentationPseudo"; presentationPseudo.setAttribute("type","text/css"); var presentationsPseudo = ['#presentationGetAllResponseHeaders:before,#presentationGetAllResponseHeaders:after { ']; //pas de cursor webkit cf. http://jsfiddle.net/qKMPQ/2/ presentationsPseudo.push('background: rgb(255,128,0)!important; background: rgba(255,128,0,.8)!important; clip: rect(0, 40px, 46px, 0)!important; color: #000!important; content: "\\00D7"!important;'); presentationsPseudo.push('cursor: pointer!important; font-size: 70px!important; height: 40px!important; letter-spacing: 0!important; line-height: 40px!important; padding: 6px 0 0 0!important; position: fixed!important;'); presentationsPseudo.push('width: 40px!important; z-index: 44445!important; }'); presentationsPseudo.push('#presentationGetAllResponseHeaders:before { border-radius: 0 0 0 18px!important; bottom: 0!important; left: 0!important; text-align: left!important; }'); presentationsPseudo.push('#presentationGetAllResponseHeaders:after { border-radius: 0 18px 0 0!important; text-align: right!important; top: 0!important; right: 0!important; }'); var presentationsPresentation = cssie + cssie8[normes] + cssprefixes[msie] + "border: 0!important; border-radius: 3%!important; bottom: auto!important; box-shadow: 0 0 24px #002, 0 0 16px #200 inset!important; -moz-box-sizing: content-box!important; box-sizing: content-box!important; clip: rect(-10000px, 10000px, 10000px, -10000px)!important; color: #000!important; column-count: 1!important; column-width: auto!important; cursor: default!important; direction: ltr!important; display: block!important; filter: none!important; float: none!important; font-family: monospace!important; font-size: 14px!important; font-size-adjust: none!important; font-stretch: normal!important; font-style: normal!important; font-variant: normal!important; font-weight: normal!important; height: 80%!important; left: 5%!important; letter-spacing: normal!important; line-height: 1.45!important; margin: 0!important; max-height: none!important; max-width: none!important; min-height: 0!important; min-width: 0!important; outline: 0!important; overflow: visible!important; padding: 5% 5% 0 5%!important; perspective: none!important; pointer-events: auto!important; position: fixed!important; right: auto!important; text-align: left!important; text-decoration: none!important; text-indent: 0!important; text-shadow: none!important; text-transform: none!important; top: 5%!important; visibility: visible!important; white-space: pre-wrap!important; width: 80%!important; z-index: 44444!important;"; presentationsPseudo.push(normes == 0 ? "#presentationGetAllResponseHeaders { " + presentationsPresentation + " }" : ""); //http://webbugtrack.blogspot.fr/2008/03/bug-329-elementsetattributestyle-fails.html inscrire.call(presentationPseudo,presentationsPseudo.join("\n")); document.getElementsByTagName("head")[0].appendChild(presentationPseudo); //IE 8 ni Safari 3 NON : document.head.appendChild(presentationPseudo); var presentation = document.createElement("pre"); presentation.id = "presentationGetAllResponseHeaders"; presentation.setAttribute("style",presentationsPresentation); var presentations = ["RENSEIGNEMENTS JAVASCRIPT de " + bookmarkletDonnees.initial.getHours().dizer() + ":"]; presentations.push(bookmarkletDonnees.initial.getMinutes().dizer() + ":" + bookmarkletDonnees.initial.getSeconds().dizer() + " :\n"); presentations.push(bookmarkletDonnees.typedoc + bookmarkletDonnees.charset + bookmarkletDonnees.modification + "\n"); var actuel = new Date(); var actualite = actuel.getHours().dizer() + ":" + actuel.getMinutes().dizer() + ":" + actuel.getSeconds().dizer(); bookmarkletDonnees.methode == "GET" && (function(){ //IE : valider le charset ; IE 8 : obtenir le document.doctype var precaution = ["- NOTA BENE (" + actualite + ") -\n"]; (normes > 0 || charset.indexOf("non declar\xE9") < 0) && (function(){ //IE : valider le charset - exemple : http://msdn.microsoft.com/en-us/library/br230269(v=vs.94).aspx precaution.push("L'encodage suivant d\xE9tect\xE9 sur MSIE tient parfois d'une reconstruction. "); precaution.push("Voici donc une d\xE9tection redondante effectu\xE9e \xE0 partir du code source :\n"); charset = (/]+charset[^>]+\/?>/i).exec(ajax.responseText); precaution.push(charset == null ? "la balise 'meta' n'est pas declar\xE9e" : charset[0]); })(); normes == 0 && (function(){ //IE 8 : obtenir le document.doctype precaution.push("\nLe doctype ne peut \xEAtre directement d\xE9tect\xE9 sur MSIE 8. "); precaution.push("Voici donc la d\xE9tection effectu\xE9e \xE0 partir du code source :\n"); dodo = (/<\!doctype[^>]+>/i).exec(ajax.responseText); precaution.push(dodo == null ? "le doctype n'est pas declar\xE9" : dodo[0]); })(); presentations.unshift(precaution.join("") + "\n\n"); })(); presentations.push("EN-T\u00CATES HTTP \u00E0 " + actualite + " :\n\u25CC\u0020"); presentations.push(ajax ? ajax.getAllResponseHeaders().replace(/\x0A(?=.)/g,saut + "\u25CC\u0020") : "La page doit \u00EAtre lue via un service HTTP"); inscrire.call(presentation,presentations.join("")); document.body.appendChild(presentation); for (var i = 0;i 0 ? d.scrollLeft : b.scrollLeft, Y = d.scrollTop > 0 ? d.scrollTop : b.scrollTop, w = d.clientWidth, h = d.clientHeight; if ((x < X + 56 && y > Y + h - 62) || (x > X + w - 56 && y < Y + 63)){ //http://interfacteur.blogspot.fr/2014/01/js-condition-ou-operation-mathematique.html for (var i = 0;i 0 ? url + ((/\?/).test(url) ? "&" : "?" ) + new Date().getTime() : url.replace(/\/{2}/,"//" + new Date().getTime() + "@"),true); //IE : risque Drupal en place et lieu du risque de cache culotte chargement.call(ajax,bookmarkletDonnees.afficher); ajax.send(); } })(); ! comment && (function(){ bookmarkletDonnees.querir = bookmarkletDonnees.afficher; })();})(); bookmarkletDonnees.querir(); bookmarkletDonnees.actif = true; })();