https://doc.cliss21.com/index.php?title=Icedove_image_liees&feed=atom&action=historyIcedove image liees - Historique des versions2024-03-29T13:35:40ZHistorique des révisions pour cette page sur le wikiMediaWiki 1.35.4https://doc.cliss21.com/index.php?title=Icedove_image_liees&diff=4025&oldid=previmported>VincentAdolphe : Page créée avec « == Principe == Par défaut Thunderbird/Icedove inclu les images sous forme d'attachement MIME. Par exemple un copié/collé d'une page web avec des images va finir dans thun… »2016-05-02T14:24:55Z<p>Page créée avec « == Principe == Par défaut Thunderbird/Icedove inclu les images sous forme d'attachement MIME. Par exemple un copié/collé d'une page web avec des images va finir dans thun… »</p>
<p><b>Nouvelle page</b></p><div>== Principe ==<br />
<br />
Par défaut Thunderbird/Icedove inclu les images sous forme d'attachement MIME. Par exemple un copié/collé d'une page web avec des images va finir dans thunderbird<br />
sous forme d'attachement MIME.<br />
<br />
La plupart du temps, ce comportement est souhaitable par exemple si l'adresse de l'image est locale: <pre>file:///home/plouf/Images/toto.png</pre><br />
<br />
Néanmoins si c'est un copié/collé d'un site web ou les adresses des images sont de toute façon accessible, et que la page comporte beaucoup d'images,<br />
ce comportement va généré un courriel assez lourd alors qu'il serait tout à fait possible de n'avoir qu'un lien sur les images.<br />
<br />
<br />
Thunderbird cherche un attribut "moz-do-not-send" pour savoir s'il doit envoyé l'image sous forme de lien ou d'attachement MIME. Par exemple:<br />
<img src="http://img.no.lan/plouf.png"><br />
image attachée sous forme MIME<br />
<img src="http://img.no.lan/plouf.png" moz-do-not-send="true"><br />
image sous forme de lien<br />
<br />
Il suffit donc de modifier le code html de la page web pour que thunderbird respecte les lien. Ceci est possible avec javascript/jQuery:<br />
<br />
jQuery('img').attr('moz-do-not-send', true);<br />
<br />
== Pratique ==<br />
<br />
En utilisant la technique des [https://fr.wikipedia.org/wiki/Bookmarklet bookmarklet], il est possible simplifier l'usage de ce script:<br />
<br />
créer un nouveau marque page dont la cible est:<br />
javascript:jQuery('img').attr('moz-do-not-send',true);<br />
<br />
Si jQuery n'existe pas sur la page on peut le charger et envoyer la modif en utilisant http://www.learningjquery.com/2009/04/better-stronger-safer-jquerify-bookmarklet/ comme base.<br />
Ce qui se justifie si le traitement par jQuery est vraiment plus simple.<br />
<br />
Sinon en javascript pur:<br />
javascript:imgs=document.getElementsByTagName('img');for(var%20idx=0;idx<imgs.length;idx++)imgs[idx].setAttribute('moz-do-not-send','true');<br />
<br />
par exemple [javascript:imgs=document.getElementsByTagName('img');for(var%20idx=0;idx<imgs.length;idx++)imgs[idx].setAttribute('moz-do-not-send','true'); Linkify]<br />
<br />
== Annexe ==<br />
En partant de jQuerify:<br />
<pre><br />
javascript:(function(){var%20el=document.createElement(%22div%22),b=document.getElementsByTagName(%22body%22)[0],otherlib=!1,msg=%22%22;el.style.position=%22fixed%22,el.style.height=%2232px%22,el.style.width=%22220px%22,el.style.marginLeft=%22-110px%22,el.style.top=%220%22,el.style.left=%2250%25%22,el.style.padding=%225px%2010px%22,el.style.zIndex=1001,el.style.fontSize=%2212px%22,el.style.color=%22#222%22,el.style.backgroundColor=%22#f99%22;function%20showMsg(){var%20txt=document.createTextNode(msg);el.appendChild(txt),b.appendChild(el),window.setTimeout(function(){txt=null,typeof%20jQuery==%22undefined%22?b.removeChild(el):(jQuery(el).fadeOut(%22slow%22,function(){jQuery(this).remove()}),otherlib&&(window.$jq=jQuery.noConflict()))},2500);jQuery('img').attr('moz-do-not-send',true);}if(typeof%20jQuery!=%22undefined%22)return%20msg=%22This%20page%20already%20using%20jQuery%20v%22+jQuery.fn.jquery,showMsg();typeof%20$==%22function%22&&(otherlib=!0);function%20getScript(url,success){var%20script=document.createElement(%22script%22);script.src=url;var%20head=document.getElementsByTagName(%22head%22)[0],done=!1;script.onload=script.onreadystatechange=function(){!done&&(!this.readyState||this.readyState==%22loaded%22||this.readyState==%22complete%22)&&(done=!0,success(),script.onload=script.onreadystatechange=null,head.removeChild(script))},head.appendChild(script)}getScript(%22http://code.jquery.com/jquery.min.js%22,function(){return%20typeof%20jQuery==%22undefined%22?msg=%22Sorry,%20but%20jQuery%20was%20not%20able%20to%20load%22:(msg=%22This%20page%20is%20now%20jQuerified%20with%20v%22+jQuery.fn.jquery,otherlib&&(msg+=%22%20and%20noConflict().%20Use%20$jq(),%20not%20$().%22)),showMsg()})})();<br />
</pre><br />
<br />
La modif se trouve à la fin de la fonction showMsg() qui est la dernière appelée - une manière d'être sûr que jQuery est chargé ou existe sur la page<br />
<br />
Le code "normal":<br />
<pre><br />
javascript: (function() {<br />
var el = document.createElement("div"),<br />
b = document.getElementsByTagName("body")[0],<br />
otherlib = !1,<br />
msg = "";<br />
el.style.position = "fixed", el.style.height = "32px", el.style.width = "220px", el.style.marginLeft = "-110px", el.style.top = "0", el.style.left = "50%", el.style.padding = "5px 10px", el.style.zIndex = 1001, el.style.fontSize = "12px", el.style.color = "#222", el.style.backgroundColor = "#f99";<br />
<br />
function showMsg() {<br />
var txt = document.createTextNode(msg);<br />
el.appendChild(txt), b.appendChild(el), window.setTimeout(function() {<br />
txt = null, typeof jQuery == "undefined" ? b.removeChild(el) : (jQuery(el).fadeOut("slow", function() {<br />
jQuery(this).remove()<br />
}), otherlib && (window.$jq = jQuery.noConflict()))<br />
}, 2500);<br />
jQuery('img').attr('moz-do-not-send',true);<br />
}<br />
if (typeof jQuery != "undefined") return msg = "This page already using jQuery v" + jQuery.fn.jquery, showMsg();<br />
typeof $ == "function" && (otherlib = !0);<br />
<br />
function getScript(url, success) {<br />
var script = document.createElement("script");<br />
script.src = url;<br />
var head = document.getElementsByTagName("head")[0],<br />
done = !1;<br />
script.onload = script.onreadystatechange = function() {<br />
!done && (!this.readyState || this.readyState == "loaded" || this.readyState == "complete") && (done = !0, success(), script.onload = script.onreadystatechange = null, head.removeChild(script))<br />
}, head.appendChild(script)<br />
}<br />
getScript("http://code.jquery.com/jquery.min.js", function() {<br />
return typeof jQuery == "undefined" ? msg = "Sorry, but jQuery was not able to load" : (msg = "This page is now jQuerified with v" + jQuery.fn.jquery, otherlib && (msg += " and noConflict(). Use $jq(), not $().")), showMsg()<br />
})<br />
})();<br />
</pre></div>imported>VincentAdolphe