kqtobserver / VolumeOhOneSelca

// ==UserScript==
// @name        VolumeOhOneSelca
// @match       *://selca.kastden.org/*/*
// @version     1.0
// @author      kqtobserver
// @license     MIT
// @description Sets video volume to 0.1 on selca.
// ==/UserScript==

function volumeohone() {
  var obs = new MutationObserver(function (mutations) {
    for (var i = 0; i < mutations.length; ++i) {
      for (var j = 0; j < mutations[i].addedNodes.length; ++j) {
        if (mutations[i].addedNodes[j].id == "full_media") {
          mutations[i].addedNodes[j].volume = 0.1
        }
      }
    }
  })
  
  obs.observe(document.querySelector("#cover_media_frame"), {
    childList: true,
  })
}

var video = document.querySelector("#full_media")
if (video) {
  video.volume = 0.1
}
volumeohone()