Skip to content

Instantly share code, notes, and snippets.

@kikegarcia
Last active December 20, 2015 02:59
Show Gist options
  • Save kikegarcia/6060531 to your computer and use it in GitHub Desktop.
Save kikegarcia/6060531 to your computer and use it in GitHub Desktop.
Jquery checks if there's a property that must replace another one and does it atm
<div id="galeria">
<h1 class="textbar">GALERÍA DE VÍDEOS</h1>
<div class="styled-select">
<select onchange="this.options[this.selectedIndex].value && (window.location = this.options[this.selectedIndex].value);">
<option value="" selected="selected" enabled='false'>SELECCIONA TU ARTISTA</option>
<!-- START videoselect -->
<option value="/video/{urlname}" name="{urlalt}">{name}</option>
<!-- END videoselect -->
</select>
</div>
</div>
<hr/>
<br/>
<div id="listavideos" style="height: 405px; !important;">
<!-- START videos -->
<div class="videoiso crop {tag}">
<a class="urlvideo" href="/video/{urlname}">
<input class="urlalt" type="hidden" value="{urlalt}"/>
<input class="imgalt" type="hidden" value="{imgalternativa}"/>
<img class="videothumbnail" src="http://img.youtube.com/vi/{idyoutube}/0.jpg">
<div class="videotext"><h3>{name}</h3></div>
</a>
</div>
<!-- END videos -->
$('input.urlalt').each(function(){
if( $(this).val() != '' ){
var newaddress = $(this).val();
var new_src = $(this).next().val();
$(this).next().next().attr('src',new_src);
$(this).parent(".urlvideo").attr("href", newaddress);
$(this).parent(".urlvideo").attr("target","_blank");
var newaddress = '';
}
});
$('select > option').each(function(){
if( $(this).attr('name') != '' ){
$(this).val($(this).attr('name'));
valid2 = false;
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment