PageSourceSearch

https://tobias-kirschstein.github.io/nersemble/static/js/index.js

js tobias-kirschstein.github.io collected 2026-10-03 10:05:29 UTC 5,626 bytes, 167 lines download raw bytes

1// window.HELP_IMPROVE_VIDEOJS = false;
2//
3// var INTERP_BASE = "./static/interpolation/stacked";
4// var NUM_INTERP_FRAMES = 240;
5//
6// var interp_images = [];
7// function preloadInterpolationImages() {
8//   for (var i = 0; i < NUM_INTERP_FRAMES; i++) {
9//     var path = INTERP_BASE + '/' + String(i).padStart(6, '0') + '.jpg';
10//     interp_images[i] = new Image();
11//     interp_images[i].src = path;
12//   }
13// }
14//
15// function setInterpolationImage(i) {
16//   var image = interp_images[i];
17//   image.ondragstart = function() { return false; };
18//   image.oncontextmenu = function() { return false; };
19//   $('#interpolation-image-wrapper').empty().append(image);
20// }
21
22var hashTableImages = {};
23function preloadHashTableImages() {
24    const targets = [-0.75, -0.5, -0.25, "0.0", 0.25, 0.5, 0.75];
25
26    let key;
27    let imageSrc;
28    for (let beta1 of targets) {
29        for (let beta2 of targets) {
30            for (let beta3 of targets) {
31                key = beta1 + "_" + beta2 + "_" + beta3
32                imageSrc = "./static/images/blend_weight_interpolations/" + key + ".jpeg"
33                hashTableImages[key] = new Image();
34                hashTableImages[key].src = imageSrc
35            }
36        }
37    }
38}
39
40function computeBlendWeightColor(beta) {
41    positiveColor = $.Color("#E06666");
42    negativeColor = $.Color("#0095dd");
43
44    if (beta < 0) {
45        blendColor = negativeColor;
46    } else {
47        blendColor = positiveColor;
48    }
49    white = $.Color("#FFF");
50    alpha = Math.abs(beta) / 0.75;
51
52    blendedColor = blendColor.alpha(alpha).blend(white.alpha(1 - alpha));
53
54    return blendedColor;
55}
56
57function updateHashTableImage() {
58    var beta1 = $("#slider-hash-table-1").val();
59    var beta2 = $("#slider-hash-table-2").val();
60    var beta3 = $("#slider-hash-table-3").val();
61
62    beta1 = beta1 == 0 ? "0.0" : beta1;
63    beta2 = beta2 == 0 ? "0.0" : beta2;
64    beta3 = beta3 == 0 ? "0.0" : beta3;
65
66    key = beta1 + "_" + beta2 + "_" + beta3;
67
68    var image = hashTableImages[key];
69    image.ondragstart = function() { return false; };
70    image.oncontextmenu = function() { return false; };
71    $('#hash-table-image-wrapper').empty().append(image);
72
73    // Update vector
74    $("#blend-weights-vector-1").css({"backgroundColor": computeBlendWeightColor(beta1)});
75    $("#blend-weights-vector-2").css({"backgroundColor": computeBlendWeightColor(beta2)});
76    $("#blend-weights-vector-3").css({"backgroundColor": computeBlendWeightColor(beta3)});
77}
78
79
80$(document).ready(function() {
81    preloadHashTableImages();
82    updateHashTableImage();
83
84    var carousels = bulmaCarousel.attach('#results-carousel', {
85        slidesToScroll: 1,
86        slidesToShow: 1,
87        loop: true,
88        infinite: true,
89        autoplay: true,
90        autoplaySpeed: 8000,
91    });
92
93    // Start playing next video in carousel and pause previous video to limit load on browser
94    for(var i = 0; i < carousels.length; i++) {
95        // Add listener to  event
96        carousels[i].on('before:show', state => {
97            var nextId = (state.next + state.length) % state.length;  // state.next can be -1 or larger than the number of videos
98            var nextVideoElement = $("#results-carousel .slider-item[data-slider-index='" + nextId + "'] video")[0];
99            var previousVideoElement = $("#results-carousel .slider-item[data-slider-index='" + state.index + "'] video")[0];
100
101            previousVideoElement.pause();
102            previousVideoElement.currentTime = 0;
103            nextVideoElement.currentTime = 0;
104            nextVideoElement.play();
105        });
106    }
107
108
109    $("#slider-hash-table-1, #slider-hash-table-2, #slider-hash-table-3").on("input", function () {
110        updateHashTableImage();
111    });
112
113    // // Check for click events on the navbar burger icon
114    // $(".navbar-burger").click(function() {
115    //   // Toggle the "is-active" class on both the "navbar-burger" and the "navbar-menu"
116    //   $(".navbar-burger").toggleClass("is-active");
117    //   $(".navbar-menu").toggleClass("is-active");
118    //
119    // });
120    //
121    // var options = {
122	// 		slidesToScroll: 1,
123	// 		slidesToShow: 3,
124	// 		loop: true,
125	// 		infinite: true,
126	// 		autoplay: false,
127	// 		autoplaySpeed: 3000,
128    // }
129    //
130	// 	// Initialize all div with carousel class
131    // var carousels = bulmaCarousel.attach('.carousel', options);
132    //
133    // // Loop on each carousel initialized
134    // for(var i = 0; i < carousels.length; i++) {
135    // 	// Add listener to  event
136    // 	carousels[i].on('before:show', state => {
137    // 		console.log(state);
138    // 	});
139    // }
140    //
141    // // Access to bulmaCarousel instance of an element
142    // var element = document.querySelector('#my-element');
143    // if (element && element.bulmaCarousel) {
144    // 	// bulmaCarousel instance is available as element.bulmaCarousel
145    // 	element.bulmaCarousel.on('before-show', function(state) {
146    // 		console.log(state);
147    // 	});
148    // }
149    //
150    // /*var player = document.getElementById('interpolation-video');
151    // player.addEventListener('loadedmetadata', function() {
152    //   $('#interpolation-slider').on('input', function(event) {
153    //     console.log(this.value, player.duration);
154    //     player.currentTime = player.duration / 100 * this.value;
155    //   })
156    // }, false);*/
157    // // preloadInterpolationImages();
158    //
159    // // $('#interpolation-slider').on('input', function(event) {
160    // //   setInterpolationImage(this.value);
161    // // });
162    // // setInterpolationImage(0);
163    // // $('#interpolation-slider').prop('max', NUM_INTERP_FRAMES - 1);
164    //
165    // bulmaSlider.attach();
166
167})

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.