js

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

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] avillepreuxjs [2024/04/22 14:36] (Version actuelle) avillepreux
Ligne 1: Ligne 1:
- 
-<html><script src="https://cdn.jsdelivr.net/npm/js-cookie@3.0.1/dist/js.cookie.min.js"></script></html> 
- 
 <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("Loading cyanide scripts");
-+
-    // Gérer les ancres "<WRAP anchor #ancre/>" +
- +
-    jQuery('.wrap_anchor').each(function()  +
-    { +
-        var id = jQuery(this).attr('id'); +
-         +
-        jQuery(this).replaceWith('<a class="anchorjs-link " href="#'+id+'" aria-label="Anchor link for: '+id+'" data-anchorjs-icon="" style="font-family: anchorjs-icons; font-style: normal; font-variant: normal; font-weight: normal; line-height: 1; padding-left: 0.375em;"></a>'); +
-    }); +
-     +
-//  Bouton "élargir la page" +
- +
-    if (typeof(fullwidth_toggle) === 'undefined'+
-    { +
-        fullwidth_toggle = true; +
-     +
-        jQuery('.dw-page-icons>ul').prepend('<li><a class="fullwidth_toggle" href="javascript:void(0);" style="text-decoration: none">◁▷</a></li>'); +
- +
-        jQuery(".fullwidth_toggle").click(function() { if (jQuery(".fullwidth_toggle").html().indexOf("◁▷") > -1) { jQuery(".fullwidth_toggle").html('▷◁'); jQuery(".container").css("width", "calc(100vw - 18px)"); jQuery(".container").css("max-width", "100%");       }  +
-                                                                                                              else { jQuery(".fullwidth_toggle").html('◁▷'); jQuery(".container").css("width", "calc(100vw - 18px)"); jQuery(".container").css("max-width", "1300px");     } }); +
-    } +
-     +
-    jQuery(".tools-animation").removeClass("tools-animation"); +
-     +
-//  On Clipboard copy +
-/* +
- +
-    jQuery("body").bind("copy", function(e) { +
- +
-        console.log("Clipboard copy detected"); +
- +
-        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; i++)  +
-                { +
-                    for (let t = 0; t < items[i].types.length; t++)  +
-                    { +
-                        if (items[i].types[t] == "text/html")  +
-                        { +
-                            items[i].getType(items[i].types[t]).then(function(blob)  +
-                            { +
-                                blob.text().then(function(html)  +
-                                { +
-                                    var modified = false; +
-                                     +
-                                    while (true) +
-                                    { +
-                                        var bgn_tag = '<'+'div class="secedit editbutton'; +
-                                        var end_tag = '<'+'/button'+'><'+'/div'+'><'+'/form'+'><'+'/div'+'>'; +
-                                     +
-                                        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, bgn_pos) + html.substring(end_pos + end_tag.length); +
-                                    } +
-                                     +
-                                    if (modified) +
-                                    {       +
-                                        const data = new Blob([html], {type: 'text/html'}) +
-                                        const item = new ClipboardItem({'text/html': data}); +
-                                        navigator.clipboard.write([item]); +
-                                         +
-                                        c.setData('text/html', html); +
-                                                                             +
-                                        console.log("Clipboard content cleaned!"); +
-                                    } +
-                                }); +
-                            }); +
-                        } +
-                    } +
-                }             +
-            }); +
-        } +
-    }); +
-     +
-    */ +
-  +
-});+
  
 </JS> </JS>
  
 +<html><script src="https://cdn.jsdelivr.net/npm/js-cookie@3.0.1/dist/js.cookie.min.js"></script></html>
  
-<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) === 'undefined'+
-    { +
-        wrap_teamsdoc = true; +
-         +
-        var original_url = jQuery(".wrap_teamsdoc").text(); +
-     +
-        var url = original_url; +
-         +
-        url = url.replace("&mobileredirect=true", ""); +
-        url = url.replace("&action=default",      ""); +
-         +
-        url = url.replace("%7B", "{"); +
-        url = url.replace("%7D", "}"); +
-         +
-        var pos = url.indexOf("&file="); +
-         +
-        if (pos 0) { +
-            url = url.substring(0, url.indexOf("&file=")); +
-            } +
-         +
-        if (url != ""+
-        {     +
-            url = url.trim() + "&amp;action=embedview"; +
-         +
-            console.log("CYA : TEAMSDOC", url); +
-         +
-            jQuery(".wrap_teamsdoc").html('<iframe src="' + url + '" width="100%" height="auto" frameborder="0"><a target="_blank" href="' + original_url + '">Show doc in Teams</a></iframe><p><a target="_blank" href="' + original_url + '">Show doc in Teams</a>'); +
-     +
-            document.querySelectorAll(".wrap_teamsdoc iframe").forEach(function(e) { +
-     +
-                e.style.aspectRatio = "1 / 2"; +
-         +
-            }); +
-        +
-    } +
- +
-}); +
- +
- +
-</JS> +
- +
- +
- +
-<CSS> +
- +
-/* Extend image effect */ +
- +
-.wrap_img-extend:before { +
-    content: "X"; +
-    display: block; +
-    position: absolute; +
-    width: calc(100% - 2 * 30px); +
-    height: 100vh; +
-    filter: brightness(2.5) saturate(0.3) blur(6px); +
-    background-size: cover; +
-+
- +
-.wrap_img-extend img { +
-    width: 100%; +
-    max-height: 100vh; +
-    object-fit: contain; +
-    position: relative; +
-+
- +
- +
- +
- +
- +
- +
- +
- +
-</CSS><JS> +
- +
-jQuery(function() { +
- +
-    if (typeof(wrap_img_extend) === 'undefined'+
-    { +
-        var wrap_img_extend = true; +
-         +
-        var extended_img= jQuery(".wrap_img-extend img"); +
-     +
-        if (extended_img && extended_img.length > 0) { +
-            document.styleSheets[0].insertRule(".wrap_img-extend:before { background-image: url('" + document.querySelector(".wrap_img-extend img").src + "'); }", 0); +
-        } +
-   } +
- +
-}); +
- +
-</JS> +
- +
-<JS> +
- +
-jQuery(function() { +
- +
-    if (typeof(wrap_nav_toc) === 'undefined'+
-    { +
-        wrap_nav_toc = true; +
-         +
-        jQuery("#inlinetoc2").each(function() { +
-            jQuery(this).prepend('<span class="toggle_choca">⧫</span>'); +
-        }); +
-   +
- +
-}); +
- +
-</JS> +
-<CSS> +
-.toggle_choca cursor: pointer; } +
-</CSS> +
- +
-<JS> +
- +
-jQuery(function() { +
- +
-    if (typeof(wrap_jenkins) === 'undefined'+
-    { +
-        wrap_jenkins = true; +
-     +
-        jQuery(".wrap_jenkins").each(function() { +
- +
-            var userdata = jQuery(this).text().split("|"); +
-            var label    = userdata[0]; +
-            var url      = userdata.length == 1 ? userdata[0] : userdata[1]; +
-                url      = "https://jenkins.cyanide-studio.com/job/" + url; +
-             +
-            jQuery(this).html('<a target="_blank" href="' + url + '"><img src="' + url + '/badge/icon"> ' + label); +
-        }); +
-    +
-}); +
- +
-</JS> +
- +
-<CSS> +
- +
-.embed-transparent { +
-    background: rgba(0,0,0,0) !important; +
-    background-color: rgba(0,0,0,0) !important; +
-    border: none !important; +
-+
- +
-</CSS><JS> +
- +
- +
-/* EMBED MODE - ?embed url param to embed intranet elsewhere */ +
- +
- +
-jQuery(document).ready(function()  +
- +
-    if (typeof(url_embed) === 'undefined'+
-    { +
-        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; i++) +
-            { +
-                var sParameterName = sURLVariables[i].split('='); +
-                if (sParameterName[0] == sParam) +
-                { +
-                    return sParameterName[1]; +
-                } +
-            } +
-        } +
-         +
-        if ("1" == url_params("embed"))  +
-        { +
-           jQuery("#dokuwiki__header, #dokuwiki__pageheader, .hidden-print, nav, .docInfo").hide(); +
-            +
-           jQuery(".panel-default, body.default.dw-page-on-panel.tpl_bootstrap3, body.optional.dw-page-on-panel.tpl_bootstrap3, .docInfo").each(function() {  +
-               jQuery(this).addClass("embed-transparent"); +
-           }); +
-        }     +
-    } +
- +
-}); // Ready +
- +
- +
- +
-/* WRAP xd - Embed XD frame */  +
- +
-jQuery(function() { +
- +
-    if (typeof(wrap_xd) === 'undefined'+
-    { +
-        wrap_xd = true; +
-     +
-         /* console.log("Parse XD iframes"); */ +
- +
-        function trimByChar(string, character) { +
- +
-            const arr = Array.from(string); +
- +
-            const first =           arr.findIndex(char =char !== character); +
-            const last  = arr.reverse().findIndex(char => char !== character); +
- +
-            return (first === -1 && last === -1) ? '' : string.substring(first, string.length - last); +
-        } +
- +
-        jQuery(".wrap_xd").each(function() { +
- +
-            var $wrap = jQuery(this); +
-            var url   = trimByChar($wrap.text().trim(), "/"); +
- +
-            if (url.indexOf("/view/") > 0) { +
-             +
-                console.log("-----------------------------------------------------------------"); +
-                console.log(url); +
-                console.log(url.substring(0,  url.indexOf("/view/"))); +
-                console.log(url.substring(6 + url.indexOf("/view/"), end)); +
- +
-                var end = url.indexOf("/", 6 + url.indexOf("/view/")); +
-                 +
-                if (end >= 0) /* has /screen/ */ +
-                { +
-                    url = url.substring(0,  url.indexOf("/view/")) + "/embed/" +  +
-                          url.substring(6 + url.indexOf("/view/"), end); +
-                } +
-                else +
-                { +
-                    url = url.substring(0,  url.indexOf("/view/")) + "/embed/" +  +
-                          url.substring(6 + url.indexOf("/view/")); +
-                +
-                       +
-                console.log(url); +
-                console.log("-----------------------------------------------------------------"); +
-            } +
- +
-            var classes = [...$wrap[0].classList]; +
- +
-            var w = 16; +
-            var h =  9; +
- +
-            for (var c = 0; c < classes.length; ++c) { +
- +
-                var classname = classes[c]; +
- +
-                if (classname.indexOf("wrap_x") >= 0) var s = classname.substring(6); if (!isNaN(s)) w = parseInt(s);+
-                if (classname.indexOf("wrap_y">= 0) { var s = classname.substring(6); if (!isNaN(s)) h = parseInt(s);+
-                if (classname.indexOf("wrap_w") >= 0) { var s = classname.substring(6); if (!isNaN(s)) w = parseInt(s);+
-                if (classname.indexOf("wrap_h") >= 0) { var s = classname.substring(6); if (!isNaN(s)) h = parseInt(s);+
-            } +
- +
-            var html = ""; +
- +
-            html += '<p>'; +
-            html += '<iframe frameborder=0 style="width: 99%; height: auto; aspect-ratio: '+w+' '+h+';" src="'+url+'"></iframe>'; +
-            html += '<a target="_blank" href="'+url+'">'+url+'</a>'; +
-            html += '</p>'; +
- +
-            $wrap.html(html); +
- +
-        }); +
-    } +
-}); +
- +
- +
-/* WRAP link Simply insert a link */ +
- +
-jQuery(document).ready(function()  +
-+
-    if (typeof(wrap_link) === 'undefined'+
-    { +
-        wrap_link= true; +
-     +
-        jQuery(".wrap_link").html('<a href="https://' + jQuery(".wrap_link").html() + '">' + jQuery(".wrap_link").html() + '</a>');  +
-    }     +
-}); +
- +
- +
- +
-/* NAV hidden on click */ +
- +
-jQuery(document).ready(function()  +
-+
-    if (typeof(wrap_hidden) === 'undefined'+
-    { +
-        wrap_hidden = true; +
-     +
-        jQuery(".wrap_nav.wrap_hidden").click(function() { +
-         +
-            jQuery(this).toggleClass("revealed"); +
-        }); +
-    } +
-}); +
- +
-</JS> +
 {{page>/js/layout_filters}} {{page>/js/layout_filters}}
 +{{page>/js/storm_hide}}
 {{page>/js/nacon_hide}} {{page>/js/nacon_hide}}
 {{page>/js/gif}} {{page>/js/gif}}
 {{page>/js/h6}} {{page>/js/h6}}
 {{page>/js/choca_menu}} {{page>/js/choca_menu}}
 +{{page>/js/url_embed}}
 {{page>/js/wrap_nav}} {{page>/js/wrap_nav}}
 +{{page>/js/wrap_nav_hidden}}
 {{page>/js/wrap_xd}} {{page>/js/wrap_xd}}
 {{page>/js/wrap_link}} {{page>/js/wrap_link}}
 {{page>/js/wrap_serge}} {{page>/js/wrap_serge}}
 +{{page>/js/wrap_jenkins}}
 +{{page>/js/wrap_img-extend}}
 +{{page>/js/wrap_diagram-url}}
 +{{page>/js/wrap_teamsdoc}}
 +{{page>/js/wrap_anchor}}
  
  • js.1676387108.txt.gz
  • Dernière modification : 2023/02/14 16:05
  • de avillepreux