This commit is contained in:
BoHung Chiu 2022-11-18 19:52:04 +08:00
parent 37aff562a7
commit 7bdccc3b60
2 changed files with 30 additions and 22 deletions

View File

@ -31,8 +31,8 @@
<div class="slide-img" style=" background: url('<%= image.exchange_item == "1" ? image.file.thumb.url : image.youtube_thumb %>'); background-size: cover; background-position: center;"></div>
<% end %>
<% else %>
<div class="slide-img" style="background: url('/annc_url?url=http://placehold.it/<%= banner.width %>x<%= banner.height %>/888&text=A'); background-size: cover; background-position: center;"></div>
<div class="slide-img" style="background: url('/annc_url?url=http://placehold.it/<%= banner.width %>x<%= banner.height %>/666&text=B'); background-size: cover; background-position: center;"></div>
<div class="slide-img" style="background: url('https://via.placeholder.com/<%= banner.width %>x<%= banner.height %>/888&text=A'); background-size: cover; background-position: center;"></div>
<div class="slide-img" style="background: url('https://via.placeholder.com/<%= banner.width %>x<%= banner.height %>/666&text=B'); background-size: cover; background-position: center;"></div>
<% end %>
</div>

View File

@ -186,9 +186,9 @@
<!-- Link -->
<div class="control-group">
<label class="control-label muted"><%= t(:link) %></label>
<label class="control-label muted" for="ad_image_out_link"><%= t(:link) %></label>
<div class="controls">
<%= f.text_field :out_link, placeholder: t('ad_banner.enter_url') %>
<%= f.text_field :out_link, placeholder: t('ad_banner.enter_url'), id: 'ad_image_out_link' %>
</div>
</div>
@ -274,25 +274,33 @@
return true;
}
$(document).ready(function(){
jplayer_ready_func_1();
$('#ad_image_video_file').change(function(){
var file = this.files ? this.files[0] : null;
var value = this.value;
if(file || value){
var file_name = file ? file.name : value.split(/[\/\\]/).last();
var type = get_video_type(file_name);
var file_url = window.URL ? window.URL.createObjectURL(file) : "file://"+ value;
$("#jquery_jplayer_1").parents('.fileupload-new').css('display','');
$("#jquery_jplayer_1").jPlayer('destroy');
jPlayer_1_data["title"] = file_name;
jPlayer_1_data[type] = file_url;
$("#jquery_jplayer_1").jPlayer(jPlayer_1);
}
})
$('#exchange_item_3 [data-dismiss="fileupload"]').on("click",function(){
$("#jquery_jplayer_1").parents('.fileupload-new').css('display','none');
})
jplayer_ready_func_1();
$('#ad_image_video_file').change(function(){
var file = this.files ? this.files[0] : null;
var value = this.value;
if(file || value){
var file_name = file ? file.name : value.split(/[\/\\]/).last();
var type = get_video_type(file_name);
var file_url = window.URL ? window.URL.createObjectURL(file) : "file://"+ value;
$("#jquery_jplayer_1").parents('.fileupload-new').css('display','');
$("#jquery_jplayer_1").jPlayer('destroy');
jPlayer_1_data["title"] = file_name;
jPlayer_1_data[type] = file_url;
$("#jquery_jplayer_1").jPlayer(jPlayer_1);
}
})
$('#exchange_item_3 [data-dismiss="fileupload"]').on("click",function(){
$("#jquery_jplayer_1").parents('.fileupload-new').css('display','none');
})
$('#ad_image_out_link').on('paste', function(e){
var pastedData = e.originalEvent.clipboardData.getData('text');
var _this = $(this);
pastedData = pastedData.replace(new RegExp('^http(s|)://' + window.location.host), '')
window.setTimeout(function(){
_this.val(pastedData);
}, 0);
})
})
</script>