MeWe Extention

add download button to audio's

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         MeWe Extention
// @namespace    https://mewe.com/i/sajad
// @version      0.11
// @description  add download button to audio's
// @match        https://mewe.com/*
// @match        https://www.mewe.com/*
// @match        https://mewe.com/i/*
// @match        https://www.mewe.com/i/*
// @author       Sajad
// @grant        none
// @run-at      document-idle
// ==/UserScript==

window.readyHandlers = [];
window.ready = function ready(handler) {
  window.readyHandlers.push(handler);
  handleState();
};

function handleState () {
  if (['interactive', 'complete'].indexOf(document.readyState) > -1) {
    while(window.readyHandlers.length > 0) {
      (window.readyHandlers.shift())();
    }
  }
}

document.onreadystatechange = window.handleState;

document.onreadystatechange = function () {
  var state = document.readyState;
  if (state == 'interactive') {

  } else if (state == 'complete') {
      setInterval(function(){ display(); }, 500);
  }
};


function display(){
  var audios = document.querySelectorAll('.audio_wrapper');
  audios.forEach(function(item){
    var pros=item.dataset.pros;
    if (pros==='done'){}
    else{
      var mp3_link = item.querySelector('audio').src;
      var elaudio= item.querySelector('audio');
      var down_but = '<a id="DBTN" download type="application/octet-stream" target="_blank" href="${mp3_link}" style= "font-weight: bold;border: 2px solid #469dc4;border-radius: 25%;left: 5px;color: #469dc4;-webkit-text-stroke-width: 2px;width: 15px;padding-top: 0px;padding-bottom: 0px;padding-left: 4px;padding-right: 4px;">⬇</a>';
      elaudio.insertAdjacentHTML('beforebegin', down_but);
    	item.dataset.pros = "done";
    }
  });
}