Différences
Ci-dessous, les différences entre deux révisions de la page.
| Les deux révisions précédentes Révision précédente Prochaine révision | Révision précédente | ||
| js [2023/02/14 16:05] – avillepreux | js [2025/07/01 14:33] (Version actuelle) – avillepreux | ||
|---|---|---|---|
| Ligne 1: | Ligne 1: | ||
| - | |||
| - | < | ||
| - | |||
| <JS> | <JS> | ||
| /* THIS SCRIPT IS COMMON TO ALL INTRANET - MODIFY WITH CARE */ | /* THIS SCRIPT IS COMMON TO ALL INTRANET - MODIFY WITH CARE */ | ||
| - | jQuery(document).ready(function() | + | /* console.log(" |
| - | { | + | |
| - | // Gérer les ancres "< | + | |
| - | + | ||
| - | jQuery(' | + | |
| - | { | + | |
| - | var id = jQuery(this).attr(' | + | |
| - | + | ||
| - | jQuery(this).replaceWith('< | + | |
| - | }); | + | |
| - | + | ||
| - | // Bouton " | + | |
| - | + | ||
| - | if (typeof(fullwidth_toggle) === ' | + | |
| - | { | + | |
| - | fullwidth_toggle = true; | + | |
| - | + | ||
| - | jQuery(' | + | |
| - | + | ||
| - | jQuery(" | + | |
| - | else { jQuery(" | + | |
| - | } | + | |
| - | + | ||
| - | jQuery(" | + | |
| - | + | ||
| - | // On Clipboard copy | + | |
| - | /* | + | |
| - | + | ||
| - | jQuery(" | + | |
| - | + | ||
| - | | + | |
| - | + | ||
| - | var c = e.originalEvent.clipboardData; | + | |
| - | + | ||
| - | if (c.types.length > 0) | + | |
| - | { | + | |
| - | var data = c.getData(c.types[0]); | + | |
| - | console.log(data); | + | |
| - | } | + | |
| - | else | + | |
| - | { | + | |
| - | navigator.clipboard.read().then(function(items) | + | |
| - | { | + | |
| - | for (let i = 0; i < items.length; | + | |
| - | { | + | |
| - | for (let t = 0; t < items[i].types.length; | + | |
| - | { | + | |
| - | if (items[i].types[t] == " | + | |
| - | { | + | |
| - | items[i].getType(items[i].types[t]).then(function(blob) | + | |
| - | { | + | |
| - | blob.text().then(function(html) | + | |
| - | { | + | |
| - | var modified = false; | + | |
| - | + | ||
| - | while (true) | + | |
| - | { | + | |
| - | var bgn_tag = '<' | + | |
| - | var end_tag = '<' | + | |
| - | + | ||
| - | var bgn_pos = html.indexOf(bgn_tag); | + | |
| - | var end_pos = html.indexOf(end_tag); | + | |
| - | + | ||
| - | if (bgn_pos < 0 || end_pos < 0) break; | + | |
| - | + | ||
| - | modified = true; | + | |
| - | + | ||
| - | html = html.substring(0, | + | |
| - | } | + | |
| - | + | ||
| - | if (modified) | + | |
| - | { | + | |
| - | const data = new Blob([html], | + | |
| - | const item = new ClipboardItem({' | + | |
| - | navigator.clipboard.write([item]); | + | |
| - | + | ||
| - | c.setData(' | + | |
| - | + | ||
| - | console.log(" | + | |
| - | } | + | |
| - | }); | + | |
| - | }); | + | |
| - | } | + | |
| - | } | + | |
| - | } | + | |
| - | }); | + | |
| - | } | + | |
| - | }); | + | |
| - | + | ||
| - | | + | |
| - | + | ||
| - | }); | + | |
| </JS> | </JS> | ||
| + | < | ||
| - | < | + | {{page>/js/new_dokuwiki}} |
| - | + | {{page>/js/clipboard}} | |
| - | /* Teams doc embedding via custom WRAP teamsdoc */ | + | {{page>/js/inline_toc}} |
| - | + | {{page>/js/fullwidth_toggle}} | |
| - | jQuery(function() | + | {{page>/js/dokuwiki_tools-animation_disable}} |
| - | + | ||
| - | if (typeof(wrap_teamsdoc) === ' | + | |
| - | | + | |
| - | wrap_teamsdoc = true; | + | |
| - | + | ||
| - | var original_url = jQuery(" | + | |
| - | + | ||
| - | var url = original_url; | + | |
| - | + | ||
| - | url = url.replace("& | + | |
| - | url = url.replace("& | + | |
| - | + | ||
| - | url = url.replace(" | + | |
| - | url = url.replace(" | + | |
| - | + | ||
| - | var pos = url.indexOf("& | + | |
| - | + | ||
| - | if (pos > 0) { | + | |
| - | url = url.substring(0, | + | |
| - | } | + | |
| - | + | ||
| - | if (url != "" | + | |
| - | { | + | |
| - | url = url.trim() + "& | + | |
| - | + | ||
| - | console.log(" | + | |
| - | + | ||
| - | jQuery(" | + | |
| - | + | ||
| - | document.querySelectorAll(" | + | |
| - | + | ||
| - | e.style.aspectRatio = "1 / 2"; | + | |
| - | + | ||
| - | | + | |
| - | | + | |
| - | } | + | |
| - | + | ||
| - | }); | + | |
| - | + | ||
| - | + | ||
| - | </ | + | |
| - | + | ||
| - | + | ||
| - | + | ||
| - | < | + | |
| - | + | ||
| - | /* Extend image effect */ | + | |
| - | + | ||
| - | .wrap_img-extend: | + | |
| - | content: " | + | |
| - | display: block; | + | |
| - | position: absolute; | + | |
| - | width: calc(100% - 2 * 30px); | + | |
| - | height: 100vh; | + | |
| - | filter: brightness(2.5) saturate(0.3) blur(6px); | + | |
| - | background-size: | + | |
| - | } | + | |
| - | + | ||
| - | .wrap_img-extend img { | + | |
| - | width: 100%; | + | |
| - | max-height: 100vh; | + | |
| - | object-fit: contain; | + | |
| - | position: relative; | + | |
| - | } | + | |
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | </CSS>< | + | |
| - | + | ||
| - | jQuery(function() { | + | |
| - | + | ||
| - | if (typeof(wrap_img_extend) === ' | + | |
| - | { | + | |
| - | var wrap_img_extend = true; | + | |
| - | + | ||
| - | var extended_img= jQuery(" | + | |
| - | + | ||
| - | if (extended_img && extended_img.length > 0) { | + | |
| - | document.styleSheets[0].insertRule(" | + | |
| - | } | + | |
| - | } | + | |
| - | + | ||
| - | }); | + | |
| - | + | ||
| - | </JS> | + | |
| - | + | ||
| - | < | + | |
| - | + | ||
| - | jQuery(function() { | + | |
| - | + | ||
| - | if (typeof(wrap_nav_toc) === ' | + | |
| - | { | + | |
| - | wrap_nav_toc = true; | + | |
| - | + | ||
| - | jQuery("# | + | |
| - | jQuery(this).prepend('< | + | |
| - | | + | |
| - | } | + | |
| - | + | ||
| - | }); | + | |
| - | + | ||
| - | </ | + | |
| - | < | + | |
| - | .toggle_choca | + | |
| - | </ | + | |
| - | + | ||
| - | < | + | |
| - | + | ||
| - | jQuery(function() | + | |
| - | + | ||
| - | if (typeof(wrap_jenkins) === ' | + | |
| - | { | + | |
| - | wrap_jenkins = true; | + | |
| - | + | ||
| - | jQuery(" | + | |
| - | + | ||
| - | var userdata = jQuery(this).text().split(" | + | |
| - | var label = userdata[0]; | + | |
| - | var url = userdata.length == 1 ? userdata[0] : userdata[1]; | + | |
| - | url = " | + | |
| - | + | ||
| - | jQuery(this).html('< | + | |
| - | | + | |
| - | | + | |
| - | }); | + | |
| - | + | ||
| - | </ | + | |
| - | + | ||
| - | < | + | |
| - | + | ||
| - | .embed-transparent | + | |
| - | background: rgba(0, | + | |
| - | background-color: | + | |
| - | border: none !important; | + | |
| - | } | + | |
| - | + | ||
| - | </ | + | |
| - | + | ||
| - | + | ||
| - | /* EMBED MODE - ?embed url param to embed intranet elsewhere */ | + | |
| - | + | ||
| - | + | ||
| - | jQuery(document).ready(function() | + | |
| - | + | ||
| - | if (typeof(url_embed) === ' | + | |
| - | { | + | |
| - | url_embed = true; | + | |
| - | + | ||
| - | function url_params(sParam) | + | |
| - | { | + | |
| - | var sPageURL = window.location.search.substring(1); | + | |
| - | var sURLVariables = sPageURL.split('&' | + | |
| - | for (var i = 0; i < sURLVariables.length; | + | |
| - | { | + | |
| - | var sParameterName = sURLVariables[i].split(' | + | |
| - | if (sParameterName[0] == sParam) | + | |
| - | { | + | |
| - | return sParameterName[1]; | + | |
| - | } | + | |
| - | } | + | |
| - | } | + | |
| - | + | ||
| - | if (" | + | |
| - | { | + | |
| - | | + | |
| - | + | ||
| - | | + | |
| - | | + | |
| - | }); | + | |
| - | } | + | |
| - | } | + | |
| - | + | ||
| - | }); // Ready | + | |
| - | + | ||
| - | + | ||
| - | + | ||
| - | /* WRAP xd - Embed XD frame */ | + | |
| - | + | ||
| - | jQuery(function() { | + | |
| - | + | ||
| - | if (typeof(wrap_xd) === ' | + | |
| - | { | + | |
| - | wrap_xd = true; | + | |
| - | + | ||
| - | /* console.log(" | + | |
| - | + | ||
| - | function trimByChar(string, | + | |
| - | + | ||
| - | const arr = Array.from(string); | + | |
| - | + | ||
| - | const first = | + | |
| - | const last = arr.reverse().findIndex(char => char !== character); | + | |
| - | + | ||
| - | return (first === -1 && last === -1) ? '' | + | |
| - | } | + | |
| - | + | ||
| - | jQuery(" | + | |
| - | + | ||
| - | var $wrap = jQuery(this); | + | |
| - | var url = trimByChar($wrap.text().trim(), | + | |
| - | + | ||
| - | if (url.indexOf(" | + | |
| - | + | ||
| - | console.log(" | + | |
| - | console.log(url); | + | |
| - | console.log(url.substring(0, | + | |
| - | console.log(url.substring(6 + url.indexOf("/ | + | |
| - | + | ||
| - | var end = url.indexOf("/", | + | |
| - | + | ||
| - | if (end >= 0) /* has /screen/ */ | + | |
| - | { | + | |
| - | url = url.substring(0, | + | |
| - | url.substring(6 + url.indexOf("/ | + | |
| - | | + | |
| - | else | + | |
| - | { | + | |
| - | url = url.substring(0, | + | |
| - | url.substring(6 + url.indexOf("/ | + | |
| - | | + | |
| - | + | ||
| - | console.log(url); | + | |
| - | console.log(" | + | |
| - | } | + | |
| - | + | ||
| - | var classes = [...$wrap[0].classList]; | + | |
| - | + | ||
| - | var w = 16; | + | |
| - | var h = 9; | + | |
| - | + | ||
| - | for (var c = 0; c < classes.length; | + | |
| - | + | ||
| - | var classname = classes[c]; | + | |
| - | + | ||
| - | if (classname.indexOf(" | + | |
| - | if (classname.indexOf(" | + | |
| - | if (classname.indexOf(" | + | |
| - | if (classname.indexOf(" | + | |
| - | } | + | |
| - | + | ||
| - | var html = ""; | + | |
| - | + | ||
| - | html += '< | + | |
| - | html += '< | + | |
| - | html += '<a target=" | + | |
| - | html += '</ | + | |
| - | + | ||
| - | $wrap.html(html); | + | |
| - | + | ||
| - | | + | |
| - | | + | |
| - | }); | + | |
| - | + | ||
| - | + | ||
| - | /* WRAP link Simply insert a link */ | + | |
| - | + | ||
| - | jQuery(document).ready(function() | + | |
| - | { | + | |
| - | if (typeof(wrap_link) === ' | + | |
| - | { | + | |
| - | wrap_link= true; | + | |
| - | + | ||
| - | jQuery(" | + | |
| - | } | + | |
| - | }); | + | |
| - | + | ||
| - | + | ||
| - | + | ||
| - | /* NAV hidden on click */ | + | |
| - | + | ||
| - | jQuery(document).ready(function() | + | |
| - | { | + | |
| - | if (typeof(wrap_hidden) === ' | + | |
| - | { | + | |
| - | wrap_hidden = true; | + | |
| - | + | ||
| - | jQuery(" | + | |
| - | + | ||
| - | jQuery(this).toggleClass(" | + | |
| - | }); | + | |
| - | } | + | |
| - | }); | + | |
| - | + | ||
| - | </ | + | |
| {{page>/ | {{page>/ | ||
| - | {{page>/ | + | {{page>/ |
| {{page>/ | {{page>/ | ||
| + | {{page>/ | ||
| {{page>/ | {{page>/ | ||
| {{page>/ | {{page>/ | ||
| + | {{page>/ | ||
| + | {{page>/ | ||
| + | {{page>/ | ||
| {{page>/ | {{page>/ | ||
| - | {{page>/ | + | {{page>/ |
| {{page>/ | {{page>/ | ||
| {{page>/ | {{page>/ | ||
| + | {{page>/ | ||
| + | {{page>/ | ||
| + | {{page>/ | ||
| + | {{page>/ | ||
| + | {{page>/ | ||
| + | {{page>/ | ||
| + | {{page>/ | ||
| + | {{page>/ | ||
| + | {{page>/ | ||
| + | {{page>/ | ||
| + | {{page>/ | ||