MCPcopy Create free account
hub / github.com/frank-lam/fullstack-tutorial / imgAdd2

Function imgAdd2

notes/docsify/js/main.js:25–48  ·  view source on GitHub ↗

* Adds event listeners to change active stylesheet and restore previously * activated stylesheet on reload. * * @example * * This link: * Foo * Will active this existing link: * <link rel="stylesheet alternate" title="

()

Source from the content-addressed store, hash-verified

23 */
24
25 function imgAdd2() {
26 var imgs = document.querySelectorAll('.content img');
27 // var imgs = document.getElementsByTagName('medium-zoom-image');
28 for (let j = 0; j < imgs.length; j++) {
29 // console.log('zheshi')
30 let img = imgs[j];
31 // console.log(img);
32 if (img.src) {
33 console.log(img.src);
34 if (!img.getAttribute('hadassets')) {
35 let hasharr = window.location.hash.split('/');
36 // console.log(hasharr);
37 let origin = window.location.origin;
38 img.setAttribute('hadassets', 1);
39 var hasharrPath = "";
40 for(var i = 1; i < hasharr.length - 1 ; i++){
41 hasharrPath += hasharr[i] + "/";
42 }
43 img.src = origin + '/' + hasharrPath + img.src.substring(origin.length + 1);
44 // img.src = origin + '/' + hasharrPath + img.src;
45 }
46 }
47 }
48 }
49
50 function imgAdd() {
51 var imgs = document.querySelectorAll('.markdown-section img');

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected