Replace variable from script to another on the same page (JS/PHP)

I have this script generated by wordpress plugin:

<script type='text/javascript'>
if (typeof(jQuery)=="function") {
    (function($) {
        $.fn.fitVids=function(){}})(jQuery)
};
jwplayer('jwplayer-0').setup({
    "aspectratio":null,
    "width":604,
    "height":410,
    "skin":"beelden",
    "primary":"html5",
    "advertising":{
        "client":"vast",
        "tag":"http://vasttag"
    },
    "sharing":{},
    "image":"http://i1.ytimg.com/vi/image/0.jpg",
    "file":"http://www.youtube.com/watch?v=hgfakjhs"
});
</script>

I simply want add this line:

Read More
,"position":"post"

after:

"http://vasttag"

I can’t edit the plugin, so is there a way to do it with javascript?

Sorry for my bad english.

Please help me!

Thanks!

Edit: This is the plugin file that generates the player:
link

if anyone knows how to add that parameter I would be very grateful 🙂

Edit 2:
I solved adding that parameter directly in the database, in wp-option table at jwp6_player_config_2 option name. If you know better solution let me know, thanks.

Related posts

Leave a Reply

3 comments

  1. Due to what the script does (it creates a new jwPlayer as soon as the script is encountered) and the fact that there seems to be no method in the jwPlayer API to edit a players settings, it is impossible to change your script as you want.
    The only solution is to edit the script at its source.

  2. I dont think you can do that using javascript.We generally use javascript to do changes in DOM and not in javascript itself.You can do one thing that you create.

    <script>
     if(typeof(jQuery)=="function")
     {
     (function($){$.fn.fitVids=function(){}})(jQuery)};
    
    jwplayer('jwplayer-0').setup({"aspectratio":null,"width":604,"height":410,"skin":"beelden","primary":"html5","advertising":{"client":"vast",,"position":"post","tag":"http://vasttag"},"sharing":{},"image":"http://i1.ytimg.com/vi/image/0.jpg","file":"http://www.youtube.com/watch?v=hgfakjhs"});
            </script>
    

    and append it somewhere in DOM using javascript or jquery.

    More better solution: Just edit the script added by plugin.It is the best approach.