PageSourceSearch

https://framablog.org/wp-content/themes/framavirtue/framavirtue.js?x99556

js framablog.org collected 2026-10-01 10:39:45 UTC 14,082 bytes, 296 lines download raw bytes

1jQuery('document').ready(function(){
2  jQuery('#topbar').before(jQuery('header > .container'));
3  jQuery('#author,#email,#url,#comment').addClass('form-control');
4
5  /* Suppression des images vides */
6  jQuery('.col-md-5').has('img[src$="placeholder-min.jpg"]').each(function() {
7    jQuery(this).hide();
8    jQuery(this).next('.col-md-7').addClass('col-md-12').removeClass('col-md-7');
9  });
10  jQuery('img[src$="placeholder-min.jpg"]').hide();
11
12  /* Boutons PDF/Imprimer */
13  jQuery('a[href*="print=pdf"]').html('<svg fill="#677890" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><path d="M369.9 97.9L286 14C277 5 264.8-.1 252.1-.1H48C21.5 0 0 21.5 0 48v416c0 26.5 21.5 48 48 48h288c26.5 0 48-21.5 48-48V131.9c0-12.7-5.1-25-14.1-34zM332.1 128H256V51.9l76.1 76.1zM48 464V48h160v104c0 13.3 10.7 24 24 24h104v288H48zm250.2-143.7c-12.2-12-47-8.7-64.4-6.5-17.2-10.5-28.7-25-36.8-46.3 3.9-16.1 10.1-40.6 5.4-56-4.2-26.2-37.8-23.6-42.6-5.9-4.4 16.1-.4 38.5 7 67.1-10 23.9-24.9 56-35.4 74.4-20 10.3-47 26.2-51 46.2-3.3 15.8 26 55.2 76.1-31.2 22.4-7.4 46.8-16.5 68.4-20.1 18.9 10.2 41 17 55.8 17 25.5 0 28-28.2 17.5-38.7zm-198.1 77.8c5.1-13.7 24.5-29.5 30.4-35-19 30.3-30.4 35.7-30.4 35zm81.6-190.6c7.4 0 6.7 32.1 1.8 40.8-4.4-13.9-4.3-40.8-1.8-40.8zm-24.4 136.6c9.7-16.9 18-37 24.7-54.7 8.3 15.1 18.9 27.2 30.1 35.5-20.8 4.3-38.9 13.1-54.8 19.2zm131.6-5s-5 6-37.3-7.8c35.1-2.6 40.9 5.4 37.3 7.8z"/></svg> <abbr>PDF</abbr>').addClass('btn btn-default');
14  jQuery('a[href*="print=print"]').html('<svg fill="#677890" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M448 192V77.25c0-8.49-3.37-16.62-9.37-22.63L393.37 9.37c-6-6-14.14-9.37-22.63-9.37H96C78.33 0 64 14.33 64 32v160c-35.35 0-64 28.65-64 64v112c0 8.84 7.16 16 16 16h48v96c0 17.67 14.33 32 32 32h320c17.67 0 32-14.33 32-32v-96h48c8.84 0 16-7.16 16-16V256c0-35.35-28.65-64-64-64zm-64 256H128v-96h256v96zm0-224H128V64h192v48c0 8.84 7.16 16 16 16h48v96zm48 72c-13.25 0-24-10.75-24-24 0-13.26 10.75-24 24-24s24 10.74 24 24c0 13.25-10.75 24-24 24z"/></svg> Imprimer').addClass('btn btn-default');
15  jQuery('.pdfprnt-top-right').addClass('btn-group btn-group-xs pdf-print').removeClass('pdfprnt-top-right').css('margin-top','-1px').wrap('<div class="text-right"></div>');
16  jQuery('.home .pdf-print,.archive .pdf-print,.search .pdf-print').remove();
17
18  /* Author Bio Box */
19  var f$_avatar = jQuery('#author-bio-box img.avatar');
20  var f$_default_avatar = function() {
21    if(f$_avatar.get(0).naturalWidth === 0) {
22      f$_avatar.attr('src', '/wp-content/plugins/fv-gravatar-cache/images/default.png')
23    }
24  }
25  if(f$_avatar.length) {
26    f$_avatar
27      .css('height','70px')
28      .on('load', function(){if(f$_avatar.get(0).complete) {f$_default_avatar()}})
29      .on('error', f$_default_avatar());
30  }
31	
32  /* Bouton « Plus d’articles » sur l’accueil */
33  jQuery('.home_blog').append(`
34  <p class="clearfix">
35    <a href="https://framablog.org/page/2/?s" class="btn btn-block btn-default">Plus d’articles</a>
36  </p>`);
37
38  /* Pas de support dans les commentaires */
39  jQuery('#comment').before('<p class="small">Pour toutes demandes d’<b>aide, questions ou idées d’améliorations</b> sur les services de Framasoft, merci de nous contacter plutôt sur <b><a href="https://contact.framasoft.org">contact.framasoft.org</a></b>.</p>');
40  const typo = jQuery('#comments .comments-title');
41  typo.text(typo.text().replace('Response', 'Réponse'));
42
43  /* Fix liens blip.framatube.org - À corriger directement en BdD */
44  jQuery('video, a, source, track').each(function() { 
45        if(jQuery(this).attr('src')!=undefined) {
46            var blip_url_src = jQuery(this).attr('src').replace('blip.framatube.org/', 'framatube.org/blip/');
47            jQuery(this).attr('src', blip_url_src);
48        }
49        if(jQuery(this).attr('poster')!=undefined) {
50            var blip_url_poster = jQuery(this).attr('poster').replace('blip.framatube.org/', 'framatube.org/blip/');
51            jQuery(this).attr('poster', blip_url_poster);
52        }
53        if(jQuery(this).attr('href')!=undefined) { 
54            var blip_url_href = jQuery(this).attr('href').replace('blip.framatube.org/', 'framatube.org/blip/');
55            jQuery(this).attr('href', blip_url_href);
56        }
57    });
58
59  /* aria-hidden sur les point médian */
60  (function median() {
61    const a11yMedian = (node) => {
62      let skip = 0;
63      if (node.nodeType === 3) {
64        const pos = node.data.indexOf('·');
65        if (pos >= 0) {
66          const span = document.createElement('span');
67          span.setAttribute('aria-hidden', 'true');
68          span.textContent = '·';
69          const found = node.splitText(pos);
70          found.splitText(1);
71          found.parentNode.replaceChild(span, found);
72          skip = 1;
73        }
74      } else if (node.nodeType === 1 && node.childNodes && !/(script|style)/i.test(node.tagName)) {
75        for (let i = 0; i < node.childNodes.length; i += 1) {
76          i += a11yMedian(node.childNodes[i]);
77        }
78      }
79      return skip;
80    };
81    a11yMedian(document.getElementsByTagName('body')[0]);
82  }());
83  /* Menu articles traduits + Framalang */
84  jQuery('.kad-topbar-left').append(
85`<div class="dropdown"><button class="btn btn-default" style="border: none;">Articles traduits</button><ul class="dropdown-menu dropdown-menu-right">
86 <li><a href="/tag/english/" class="dropdown-item">English</a></li><li><a href="/tag/italiano/" class="dropdown-item" >Italiano</a></li><li style="border-top: 1px solid #e5e5e5; background: none;"><a href="https://framalang.org" class="dropdown-item">➕ Framalang</a></li></ul></div>`);
87
88  /* Menu */
89  jQuery('#menu-barre-du-haut')
90    .prepend('<li><a id="menuHamburger" href="#" onclick="jQuery(\'#aside-container\').toggle(); return false;">Menu</li>');
91
92  jQuery('#topbar').after('<div id="aside-container"></div>');
93  jQuery('#menuHamburger').trigger('click'); /* Menu hidden by default */
94  jQuery('#aside-container').prepend(jQuery('aside.kad-sidebar'));
95
96  jQuery('aside.kad-sidebar')
97    .prepend('<a href="/" class="btn btn-xs btn-default">Retour à l’accueil</a>')
98    .append('<p class="clearfix" style="clear:both"><a class="btn-block text-center" href="#" onclick="jQuery(\'#menuHamburger\').trigger(\'click\'); return false;"><b>Fermer le menu</b></a>');
99
100  jQuery('#recent-posts-2')
101    .append(jQuery('#archives-2'))
102    .before(jQuery('#categories-2'));
103
104  jQuery('#tag_cloud-2')
105    .append(jQuery('#text-4'));
106
107  /* Article header */
108  const postImage = jQuery('article .meta_post_image meta[itemprop="url"]').attr('content');
109  jQuery('.single-post #wrapper .wrap')
110    .prepend(`<div id="postImage" style="background-image: url('${postImage}');"></div>`);
111
112  jQuery('.single-post article header h1')
113    .after('<p id="postTime"></p>');
114
115  jQuery('#postTime')
116    .prepend(jQuery('.wtr-time-wrap .label'))
117    .prepend('|&nbsp;')
118    .prepend(jQuery('.postmeta.updated .postdate'))
119    .prepend('&nbsp;<i class="fa fa-calendar-o" aria-hidden="true"></i>')
120    .prepend(jQuery('.subhead .author'));
121
122  jQuery('#postTime a').after('&nbsp;');
123
124  /* Action buttons (print, comments) */
125  jQuery('.single-post #content .main').before('<div id="actionButtons"></div>');
126
127  jQuery('#actionButtons')
128    .append(jQuery('.pdfprnt-buttons'));
129
130  if (document.getElementById('comments')) {
131    jQuery('#actionButtons').prepend('<a id="btn-comments" href="#comments"></a>');
132  } else {
133	jQuery('#actionButtons').prepend('<a id="btn-comments" href="#respond"></a>');
134  }
135	
136  jQuery('#actionButtons #btn-comments')
137    .append(jQuery('.subhead .postcommentscount'));
138
139  jQuery('.comment-reply-link')
140    .addClass('btn btn-xs btn-default')
141    .html('<i class="fa fa-mail-reply" aria-hidden="true"></i>&nbsp;Répondre');
142
143  jQuery(window).scroll(() => {
144    if (jQuery(window).scrollTop() > 400) {
145      jQuery('#actionButtons').css({
146        top: '200px',
147        position: 'fixed',
148      });
149    } else {
150      jQuery('#actionButtons').css({
151        top: 'auto',
152        position: 'absolute',
153      });
154    }
155  });
156
157  /* Category + Tags */
158  jQuery('.posttags').before(jQuery('.subhead .postedintop'));
159  jQuery('.single-footer').prepend(jQuery('.kad-post-navigation'));
160
161    /* Troll et écriture inclusive */
162  jQuery('.comment-body').has('.comment-author a[href*="://troll.frama"]').addClass('troll');
163  jQuery('.comment-body')
164    .has('.comment-author a[href*="blog.org/2018/08/13/ecriture-du-blog"]')
165    .addClass('troll median')
166    .append(`<div class="alert alert-warning" style="padding: 20px; border-style: solid">L’utilisation de l’écriture inclusive sur nos sites n’est pas récente, nous l’employons depuis 2015.<br>Nous en expliquons les raisons dans <a href="https://framablog.org/2018/08/13/ecriture-du-blog-nous-ne-transigerons-pas-sur-les-libertes/">cet article</a>.</div>`);
167
168  jQuery('.comment-body.troll').find('.comment-content, .comment-meta').hide();
169  jQuery('.comment-body.troll').append(`
170    <a class="btn btn-xs btn-default"
171      style="position:absolute; top:-1px; border-color: #ddd; padding: 0px 8px; right: 20px; border-radius: 0 0 3px 3px;"
172      onclick="jQuery(this).hide(); jQuery(this).parent().find('.comment-content, .comment-meta').show(); return false;">
173      <i class="fa fa-chevron-down" aria-hidden="true"></i>
174      <span class="sr-only">Afficher le commentaire</span>
175    </a>
176  `);
177
178  jQuery('#comments > ol > .comment')
179    .has('> .media-body > .comment-body.troll')
180    .addClass('trollTopic');
181  jQuery('#comments > ol > .comment')
182    .has('> .media-body > .comment-body.troll')
183    .append(`
184      <a class="btn btn-block btn-default"
185        style="border-color: #ddd; border-radius: 0; margin: 0 4px; width: calc(100% - 4px)"
186        onclick="jQuery(this).hide(); jQuery(this).parent().removeClass('trollTopic'); return false;">
187        Ici une discussion hors-sujet a été masquée. Cliquez pour l’afficher.
188      </a>
189  `);
190
191  /* Cleaning */
192  jQuery('p').each(function cleaningP() {
193    if (jQuery(this).html() === '&nbsp;') {
194      jQuery(this).remove();
195    }
196  });
197}); // -> jQuery('document').ready()
198
199window.onload = () => {
200  /* Newsletter to Listmonk */
201  if (document.body.classList.contains('admin-bar', 'newsletter')) {
202    /* data */
203    let nl2lm = {
204      clone: document.querySelector('article .entry-content').cloneNode(true),
205      img: document.querySelector('article .meta_post_image meta[itemprop="url"]').getAttribute('content'),
206      html: '',
207	  title: document.querySelector('article header h1').innerHTML,
208	  wtr: document.querySelector('article .entry-content #wtr-content').cloneNode(true)
209    }
210
211    /* template */
212    document.getElementById('actionButtons').insertAdjacentHTML('beforeend', `
213      <textarea
214        id="nl2lm-code"
215        class="sr-only"
216        readonly
217        rows="10"
218        style="width: 1px; height: 1px"
219      ></textarea>
220      <a
221        id="nl2lm-btn"
222        class="btn"
223        style="margin: 0 0 0 10px"
224        title="Copier la source HTML"
225      >
226        <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" fill="#677890">
227          <path d="M224 0c-35.3 0-64 28.7-64 64V288c0 35.3 28.7 64 64 64H448c35.3 0 64-28.7 64-64V64c0-35.3-28.7-64-64-64H224zM64 160c-35.3 0-64 28.7-64 64V448c0 35.3 28.7 64 64 64H288c35.3 0 64-28.7 64-64V384H304v64c0 8.8-7.2 16-16 16H64c-8.8 0-16-7.2-16-16V224c0-8.8 7.2-16 16-16h64V160H64z"></path>
228        </svg>
229        <span class="sr-only">Copier la source HTML</span>
230        <span
231          id="nl2lm-copied"
232          class="hidden"
233          style="position: absolute;
234          background: var(--f-b6);
235          color: var(--f--d1);
236          font-size: .75rem;
237          display: block;
238          padding: 0.125rem 0.25rem;
239          border-radius: 4px;
240          margin: -21px 0 0 25px;"
241        >Copié !</span>
242      </a>`);
243
244    /* mounted */
245    cleanNlSrc();
246    document.getElementById('nl2lm-code').value = nl2lm.html;
247	document.getElementById('nl2lm-btn').addEventListener('click', (() => { return copyNlSrc(); }));
248	
249	/* methods */
250    function cleanNlSrc() {
251      nl2lm.clone.removeChild(nl2lm.clone.querySelector('.wtr-time-wrap'));// plugin Worth The Read
252      nl2lm.clone.removeChild(nl2lm.clone.querySelector('#wtr-content'));// plugin Worth The Read
253      nl2lm.clone.querySelectorAll('img').forEach((img) => {
254        ['decoding', 'class', 'loading', 'srcset', 'sizes']
255          .forEach(attr => img.removeAttribute(attr));
256      });
257	  nl2lm.wtr.querySelectorAll('img').forEach((img) => {
258        ['decoding', 'class', 'loading', 'srcset', 'sizes']
259          .forEach(attr => img.removeAttribute(attr));
260      });
261	  
262
263      nl2lm.html = nl2lm.clone
264        .innerHTML
265		.replace(/^/, nl2lm.wtr // plugin Worth The Read
266		  .innerHTML
267		  .replace(/^<span (.*)><\/span><div class=\"text-right\"><\/div>/, ''))
268        .replace(/(^\s+|\s+$)/g, '') // spaces
269        .replace(/&nbsp;/g, ' ') // inseccables fines 
270        .replace(/<span aria-hidden="true">·<\/span>/g, '·') // script custom
271		.replace(/ data-rel="lightbox"/g, '') // Wordpress
272		.replace(/ fetchpriority="high"/g, '') // Wordpress
273		.replace(/:\/\/(www\.)?frama.space/g, '://framaspace.org') // .space reputation
274		.replace(/rama.space/g, 'ramaspace') // avoid convertion into a link
275        .replace(/\/abc\/?"/g, '/"') // /abc not needed
276		.replace(/^/, `<h1><img src="${nl2lm.img}" alt="${nl2lm.title}"></h1>`)
277		.replace(/<h1><span/g, '<h1')
278		.replace(/<\/span><\/h1>/g, '</h1>')
279		.replace(/<h2><span/g, '<h2')
280		.replace(/<\/span><\/h2>/g, '</h2>')
281		.replace(/<blockquote>/g, '<div class="blockquote">')
282		.replace(/<\/blockquote>/g, '</div>')
283		.replace(/<a /g, '<a rel="notrack" '); // notrack for Mailjet
284    }
285
286    function copyNlSrc() {
287      document.getElementById('nl2lm-code').select();
288      document.execCommand('copy');
289      document.getElementById('nl2lm-copied').classList.remove('hidden');
290      setTimeout(() => {
291        document.getElementById('nl2lm-copied').classList.add('hidden');
292      }, 2000);
293      return false;
294    }
295  }
296}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.