Compare commits
2 Commits
e774fccd55
...
431e3f9f4c
Author | SHA1 | Date |
---|---|---|
|
431e3f9f4c | |
|
74b5257bc4 |
|
@ -34,7 +34,10 @@ class VideoProSetting
|
||||||
if post_agency_was.present?
|
if post_agency_was.present?
|
||||||
video_image.title_translations.each do |k, v|
|
video_image.title_translations.each do |k, v|
|
||||||
tmp2 = tmp[k]
|
tmp2 = tmp[k]
|
||||||
tmp2 = [] if tmp2.nil?
|
if tmp2.nil?
|
||||||
|
tmp2 = []
|
||||||
|
tmp[k] = tmp2
|
||||||
|
end
|
||||||
if v.present? && tmp2.include?(post_agency_was) && VideoImage.where(:id.ne=>video_image.id, :override_post_agency=>post_agency_was, :use_override_post_agency=>true).count == 0
|
if v.present? && tmp2.include?(post_agency_was) && VideoImage.where(:id.ne=>video_image.id, :override_post_agency=>post_agency_was, :use_override_post_agency=>true).count == 0
|
||||||
save_flag = true
|
save_flag = true
|
||||||
tmp2.delete(post_agency_was)
|
tmp2.delete(post_agency_was)
|
||||||
|
@ -45,7 +48,10 @@ class VideoProSetting
|
||||||
video_image.title_translations.each do |k, v|
|
video_image.title_translations.each do |k, v|
|
||||||
if v.present?
|
if v.present?
|
||||||
tmp2 = tmp[k]
|
tmp2 = tmp[k]
|
||||||
tmp2 = [] if tmp2.nil?
|
if tmp2.nil?
|
||||||
|
tmp2 = []
|
||||||
|
tmp[k] = tmp2
|
||||||
|
end
|
||||||
save_flag = true
|
save_flag = true
|
||||||
tmp2 << post_agency unless tmp2.include?(post_agency)
|
tmp2 << post_agency unless tmp2.include?(post_agency)
|
||||||
end
|
end
|
||||||
|
@ -61,7 +67,10 @@ class VideoProSetting
|
||||||
if user_id_was.present?
|
if user_id_was.present?
|
||||||
video_image.title_was.each do |k, v|
|
video_image.title_was.each do |k, v|
|
||||||
tmp2 = tmp[k]
|
tmp2 = tmp[k]
|
||||||
tmp2 = [] if tmp2.nil?
|
if tmp2.nil?
|
||||||
|
tmp2 = []
|
||||||
|
tmp[k] = tmp2
|
||||||
|
end
|
||||||
if v.present? && tmp2.include?(user_id_was) && VideoImage.where(:id.ne=>video_image.id, :update_user_id=>user_id_was, :use_override_post_agency=>false).count == 0
|
if v.present? && tmp2.include?(user_id_was) && VideoImage.where(:id.ne=>video_image.id, :update_user_id=>user_id_was, :use_override_post_agency=>false).count == 0
|
||||||
save_flag = true
|
save_flag = true
|
||||||
tmp2.delete(user_id_was)
|
tmp2.delete(user_id_was)
|
||||||
|
@ -71,7 +80,10 @@ class VideoProSetting
|
||||||
video_image.title_translations.each do |k, v|
|
video_image.title_translations.each do |k, v|
|
||||||
if v.present?
|
if v.present?
|
||||||
tmp2 = tmp[k]
|
tmp2 = tmp[k]
|
||||||
tmp2 = [] if tmp2.nil?
|
if tmp2.nil?
|
||||||
|
tmp2 = []
|
||||||
|
tmp[k] = tmp2
|
||||||
|
end
|
||||||
save_flag = true
|
save_flag = true
|
||||||
tmp2 << user_id unless tmp2.include?(user_id)
|
tmp2 << user_id unless tmp2.include?(user_id)
|
||||||
end
|
end
|
||||||
|
@ -90,7 +102,10 @@ class VideoProSetting
|
||||||
video_image.title_translations.each do |k, v|
|
video_image.title_translations.each do |k, v|
|
||||||
if v.present?
|
if v.present?
|
||||||
tmp2 = tmp[k]
|
tmp2 = tmp[k]
|
||||||
tmp2 = [] if tmp2.nil?
|
if tmp2.nil?
|
||||||
|
tmp2 = []
|
||||||
|
tmp[k] = tmp2
|
||||||
|
end
|
||||||
save_flag = true
|
save_flag = true
|
||||||
tmp2 << post_agency unless tmp2.include?(post_agency)
|
tmp2 << post_agency unless tmp2.include?(post_agency)
|
||||||
end
|
end
|
||||||
|
@ -103,7 +118,10 @@ class VideoProSetting
|
||||||
video_image.title_translations.each do |k, v|
|
video_image.title_translations.each do |k, v|
|
||||||
if v.present?
|
if v.present?
|
||||||
tmp2 = tmp[k]
|
tmp2 = tmp[k]
|
||||||
tmp2 = [] if tmp2.nil?
|
if tmp2.nil?
|
||||||
|
tmp2 = []
|
||||||
|
tmp[k] = tmp2
|
||||||
|
end
|
||||||
save_flag = true
|
save_flag = true
|
||||||
tmp2 << user_id unless tmp2.include?(user_id)
|
tmp2 << user_id unless tmp2.include?(user_id)
|
||||||
end
|
end
|
||||||
|
@ -120,7 +138,10 @@ class VideoProSetting
|
||||||
if post_agency.present?
|
if post_agency.present?
|
||||||
video_image.title_translations.each do |k, v|
|
video_image.title_translations.each do |k, v|
|
||||||
tmp2 = tmp[k]
|
tmp2 = tmp[k]
|
||||||
tmp2 = [] if tmp2.nil?
|
if tmp2.nil?
|
||||||
|
tmp2 = []
|
||||||
|
tmp[k] = tmp2
|
||||||
|
end
|
||||||
if v.present? && tmp2.include?(post_agency) && VideoImage.where(:id.ne=>video_image.id, :override_post_agency=>post_agency, :use_override_post_agency=>true).count == 0
|
if v.present? && tmp2.include?(post_agency) && VideoImage.where(:id.ne=>video_image.id, :override_post_agency=>post_agency, :use_override_post_agency=>true).count == 0
|
||||||
save_flag = true
|
save_flag = true
|
||||||
tmp2.delete(post_agency)
|
tmp2.delete(post_agency)
|
||||||
|
@ -133,7 +154,10 @@ class VideoProSetting
|
||||||
tmp = self.exist_user_ids_translations
|
tmp = self.exist_user_ids_translations
|
||||||
video_image.title_translations.each do |k, v|
|
video_image.title_translations.each do |k, v|
|
||||||
tmp2 = tmp[k]
|
tmp2 = tmp[k]
|
||||||
tmp2 = [] if tmp2.nil?
|
if tmp2.nil?
|
||||||
|
tmp2 = []
|
||||||
|
tmp[k] = tmp2
|
||||||
|
end
|
||||||
if v.present? && tmp2.include?(user_id) && VideoImage.where(:id.ne=>video_image.id, :update_user_id=>user_id, :use_override_post_agency=>false).count == 0
|
if v.present? && tmp2.include?(user_id) && VideoImage.where(:id.ne=>video_image.id, :update_user_id=>user_id, :use_override_post_agency=>false).count == 0
|
||||||
save_flag = true
|
save_flag = true
|
||||||
tmp2.delete(user_id)
|
tmp2.delete(user_id)
|
||||||
|
|
|
@ -1,33 +1,46 @@
|
||||||
<div class="w-video_data video_data-widget-2">
|
<div class="w-video_data video_data-widget-2">
|
||||||
<%= javascript_include_tag 'video_pro/wordcloud2.js' %>
|
<%= javascript_include_tag 'video_pro/wordcloud2.js' %>
|
||||||
<div style="width: 100%; height: 60vw" class="my_favorite_latin_words jqcloud"><div>
|
<div style="width: 100%; height: 40vw" class="my_favorite_latin_words jqcloud wordcloud2"><div>
|
||||||
<script>
|
<script>
|
||||||
$(document).ready(function(){
|
var container_{{subpart-id}} = $('[data-subpart-id="{{subpart-id}}"] .my_favorite_latin_words');
|
||||||
var container = $('[data-subpart-id="{{subpart-id}}"] .my_favorite_latin_words');
|
var width_{{subpart-id}} = container_{{subpart-id}}.width();
|
||||||
var width = container.width();
|
container_{{subpart-id}}.attr('width', width_{{subpart-id}})
|
||||||
container.attr('width', width)
|
var jqcloud_words_{{subpart-id}} = {{jqcloud_words}};
|
||||||
var jqcloud_words = {{jqcloud_words}};
|
var text_map_{{subpart-id}} = {};
|
||||||
var text_map = {};
|
var max_value_{{subpart-id}} = 1;
|
||||||
var max_value = 1;
|
$.each(jqcloud_words_{{subpart-id}}, function(i, v){
|
||||||
$.each(jqcloud_words, function(i, v){
|
if (max_value_{{subpart-id}} < v.weight){
|
||||||
if (max_value < v.weight){
|
max_value_{{subpart-id}} = v.weight;
|
||||||
max_value = v.weight;
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
var list = $.map(jqcloud_words, function(v){
|
var list_{{subpart-id}} = $.map(jqcloud_words_{{subpart-id}}, function(v){
|
||||||
text_map[v.text] = v.link;
|
text_map_{{subpart-id}}[v.text] = v.link;
|
||||||
return [[v.text, Math.ceil(v.weight/max_value*3), v.link]];
|
return [[v.text, Math.ceil(v.weight/max_value_{{subpart-id}}*3), v.link]];
|
||||||
});
|
});
|
||||||
container.on('wordcloudstop', function (e) {
|
container_{{subpart-id}}.on('wordcloudstop', function (e) {
|
||||||
$(this).children('span').each(function (i, v) {
|
$(this).children('span').each(function (i, v) {
|
||||||
var text = $(this).html();
|
var text = $(this).html();
|
||||||
$(this).html('<a title="'+ list[i][0] + '" style="color: inherit" href="' + list[i][2] +'">' + text + '</a>');
|
$(this).html('<a title="'+ list_{{subpart-id}}[i][0] + '" style="color: inherit" href="' + list_{{subpart-id}}[i][2] +'">' + text + '</a>');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
WordCloud(container[0], {
|
$(document).ready(function(){
|
||||||
list: list,
|
WordCloud(container_{{subpart-id}}[0], {
|
||||||
|
list: list_{{subpart-id}},
|
||||||
gridSize: 3,
|
gridSize: 3,
|
||||||
weightFactor: jqcloud_words.length * width / 550,
|
weightFactor: jqcloud_words_{{subpart-id}}.length * width_{{subpart-id}} / 550,
|
||||||
|
rotateRatio: 0,
|
||||||
|
shuffle: false,
|
||||||
|
drawOutOfBound: false,
|
||||||
|
shrinkToFit: true,
|
||||||
|
shape: 'square'
|
||||||
|
});
|
||||||
|
})
|
||||||
|
$(window).resize(function(){
|
||||||
|
width_{{subpart-id}} = container_{{subpart-id}}.width();
|
||||||
|
WordCloud(container_{{subpart-id}}[0], {
|
||||||
|
list: list_{{subpart-id}},
|
||||||
|
gridSize: 3,
|
||||||
|
weightFactor: jqcloud_words_{{subpart-id}}.length * width_{{subpart-id}} / 550,
|
||||||
rotateRatio: 0,
|
rotateRatio: 0,
|
||||||
shuffle: false,
|
shuffle: false,
|
||||||
drawOutOfBound: false,
|
drawOutOfBound: false,
|
||||||
|
|
Loading…
Reference in New Issue