![]() ![]() |
request - wikipedia - make the...
An ogg version of an inline player isn't needed - just the ability to click the link and have it play. example Archaea
Archaea [.ogg audio link]
There doesn't seem to already be such a script. Your search - sound | audio intitle:wikipedia site:userscripts.org/scripts/show - did not match any documents.
I'm assume making such a script would be very easy for some of you - but it would take me hours more time. |
![]() ![]() |
Actually there is such a script (http://userscripts.org/scripts/show/779) but the player that it uses seems to throw a 403 error. |
![]() ![]() |
That script... Inline Mp3 Player
...doesn't work. The key problem being: Mp3. Why don't you use something to capture the title + url? Having the title there too makes things a lot clearer. I edited my first post. |
![]() ![]() |
No that's not really the problem, just change the regex and it works on mp3 too. But like I said, the player it uses throws a 403 forbidden error when you access it, so even though the script adds the code, the player doesn't load. Maybe you could find a new player and adapt the script. |
![]() ![]() |
If you restrict your script to Firefox 3.5 or higher, you can use the |
![]() ![]() |
Hmm, audio tag, that's cool.
var array=document.evaluate("//a[contains(@href, '.mp3') or contains(@href, '.ogg') or contains(@href, 'wav') or contains(@href, 'wave')]", document, null, 6, null), regex=/\.(mp3|ogg|wave?)$/i;
for(let i=0,item; (item=array.snapshotItem(i)); i++) {
if(regex.test(item.href)) {
var audio=document.createElement("audio");
audio.src=item.href;
document.body.appendChild(audio);
item.setAttribute("onclick", "return false;");
item.removeAttribute("target");
item.addEventListener("click", function(e) {audio.play();}, false);
}
}
I remove the target attribute because I have the "Offsite links in new window" and it would play but open a new window too. |
![]() ![]() |
@devnull69
Thanks. I remove the target attribute because I have the "Offsite links in new window" and it would play but open a new window too. Middle click opens a blank tab with the url javascript:void(0);.
The page also scrolls to the top. I use stylish - so the link is lower on the page. |
![]() ![]() |
@ekbworldwide: My script doesn't scroll to the top any more. Maybe you will have to reinstall it. I had to update it very shortly after my first response to prevent it from doing that. |
![]() ![]() |
Okay. Middle click now opens I think it's better if a middle click opens the .ogg link. |
![]() ![]() |
Changed accordingly ... please reinstall again |
![]() ![]() |
ekbworldwide wrote:Why would you middle click it? ekbworldwide wrote:Not with my code. ekbworldwide wrote:Updated my code above. Should work like that. |
![]() ![]() |
Why would you middle click it? I developed the habit of clicking middle clicking at many sites - I don't like back button navigation. In fact - I hate it. Also middle clicking should never open a blank tab (with or without javascription in the address bar). link + # is much better. It's amazing to me that even popular sites force open a useless blank tab on middle click. @devnull69 You could add tags to your script so it's easier to find: wikipedia, ogg, audio (or whatever). And a screen shot wouldn't hurt. Images make things clearer and not everybody can read English (well). |
![]() ![]() |
@devnull69
Your code fails on this page: Schadenfreude
@devnull69 I'll make future comment in your script's comment thread. |
![]() ![]() |
Changed ... please reinstall :-) |

