MailOnline / videojs-vast-vpaid

video.js vast plugin
MIT License
296 stars 231 forks source link

Advertisement label #219

Open michalk-k opened 8 years ago

michalk-k commented 8 years ago

How can I change/localize 'Advertisement' label without modifying the plugin code? I tried to run : $('.vjs-ads-label').html('Reklama'); in response of various events (vast.contentStart, vast.adStart, play) without success. For sure this snippet works from JS console.

For more common solution I asked here: https://github.com/MailOnline/videojs-vast-vpaid/issues/170

hwde commented 8 years ago

You could use the following CSS, maybe you have to adjust the width to match your text:

<style type="text/css">
.vjs-ads-label {
    visibility: hidden;
}
.vjs-ads-label:after {
    content: 'Reklama';
    position: absolute;
    left: 0px;
    top: 0px;
    visibility: visible;
}
</style>
michalk-k commented 8 years ago

Thank you. It works. As you said, width of .vjs-ads-label element have to be adjusted:

.vjs-ads-label {
    visibility: hidden;
    width: 60px !important
}

Originally width is set to auto which seems to be better idea, but it still renders original string. display:none cannot be used because it causes :after to disappear too.

I still think, strings dictionary would match best practices better, allowing language auto-selection and more. That's why I uphold the original request.

On the other side, what you suggested fits my needs in 100%. Thank you.