Skip to content

Commit 0a11f03

Browse files
committed
link to search
1 parent 2eaa8a5 commit 0a11f03

3 files changed

Lines changed: 21 additions & 15 deletions

File tree

public/js/dictio.js

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -756,17 +756,23 @@ function loadSearchResult(ev) {
756756
function addSearchLinks() {
757757
let orig_url = window.location.pathname;
758758
let orig_url_ar = orig_url.split('/');
759-
$('.add-search-link').each(function () {
760-
let link_ar = this.getAttribute('href').split('/');
761-
let new_url_ar = [...orig_url_ar];
762-
new_url_ar[1] = link_ar[1];
763-
new_url_ar[5] = link_ar[3];
764-
let new_url = new_url_ar.join('/');
765-
this.setAttribute('href', new_url + window.location.search);
766-
this.setAttribute('data-dict', link_ar[1]);
767-
this.setAttribute('data-entryid', link_ar[3]);
768-
this.setAttribute('onclick', 'return loadSearchResult(this)');
769-
})
759+
if (!orig_url.includes('/show/')) {
760+
$('.add-search-link,.video-link').each(function () {
761+
if (this.getAttribute('href') != '' && this.getAttribute('href').includes('/show/')) {
762+
let link_ar = this.getAttribute('href').split('/');
763+
let new_url_ar = [...orig_url_ar];
764+
new_url_ar[1] = link_ar[1];
765+
new_url_ar[5] = link_ar[3];
766+
let new_url = new_url_ar.join('/');
767+
this.setAttribute('href', new_url + window.location.search);
768+
this.setAttribute('data-dict', link_ar[1]);
769+
this.setAttribute('data-entryid', link_ar[3]);
770+
if (!$(this).hasClass('video-link')) {
771+
this.setAttribute('onclick', 'return loadSearchResult(this)');
772+
}
773+
}
774+
})
775+
}
770776
}
771777

772778
// run translation on document load

views/entrysigndetail.slim

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@
110110
.video.video--small
111111
.video__content
112112
- if @entry['media'][var['_text']]['main_for_entry']
113-
video.video-link width="100%" onmouseover="this.play()" onmouseout="" poster="/thumb/video#{@entry['dict']}/#{@entry['media'][var['_text']]['location']}" data-url="/#{@entry['media'][var['_text']]['main_for_entry']['dict']}/show/#{@entry['media'][var['_text']]['main_for_entry']['id']}"
113+
video.video-link width="100%" onmouseover="this.play()" onmouseout="" poster="/thumb/video#{@entry['dict']}/#{@entry['media'][var['_text']]['location']}" data-dict="#{@entry['media'][var['_text']]['main_for_entry']['dict']}" data-entryid="#{@entry['media'][var['_text']]['main_for_entry']['id']}" href=(@search.to_s != ''? "#{@search_path}/#{@entry['media'][var['_text']]['main_for_entry']['id']}" : "/#{@entry['media'][var['_text']]['main_for_entry']['dict']}/show/#{@entry['media'][var['_text']]['main_for_entry']['id']}")
114114
source src="https://files.dictio.info/video#{@entry['dict']}/#{@entry['media'][var['_text']]['location']}" type="video/mp4"
115115
- else
116116
video width="100%" controls="" onmouseover="this.play()" onmouseout="" poster="/thumb/video#{@entry['dict']}/#{@entry['media'][var['_text']]['location']}"
@@ -170,7 +170,7 @@
170170
.video.video--small
171171
.video__content
172172
- if @entry['media'][var['_text']]['main_for_entry']
173-
video.video-link width="100%" onmouseover="this.play()" onmouseout="" poster="/thumb/video#{@entry['dict']}/#{@entry['media'][var['_text']]['location']}" data-url="/#{@entry['media'][var['_text']]['main_for_entry']['dict']}/show/#{@entry['media'][var['_text']]['main_for_entry']['id']}"
173+
video.video-link width="100%" onmouseover="this.play()" onmouseout="" poster="/thumb/video#{@entry['dict']}/#{@entry['media'][var['_text']]['location']}" data-dict="#{@entry['media'][var['_text']]['main_for_entry']['dict']}" data-entryid="#{@entry['media'][var['_text']]['main_for_entry']['id']}" href=(@search.to_s != ''? "#{@search_path}/#{@entry['media'][var['_text']]['main_for_entry']['id']}" : "/#{@entry['media'][var['_text']]['main_for_entry']['dict']}/show/#{@entry['media'][var['_text']]['main_for_entry']['id']}")
174174
source src="https://files.dictio.info/video#{@entry['dict']}/#{@entry['media'][var['_text']]['location']}" type="video/mp4"
175175
- else
176176
video width="100%" controls="" onmouseover="this.play()" onmouseout="" poster="/thumb/video#{@entry['dict']}/#{@entry['media'][var['_text']]['location']}"

views/entrysigndetail_edit.slim

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@
120120
.video.video--small
121121
.video__content
122122
- if @entry['media'][var['_text']]['main_for_entry']
123-
video.video-link width="100%" onmouseover="this.play()" onmouseout="" poster="/thumb/video#{@entry['dict']}/#{@entry['media'][var['_text']]['location']}" data-url="/#{@entry['media'][var['_text']]['main_for_entry']['dict']}/show/#{@entry['media'][var['_text']]['main_for_entry']['id']}"
123+
video.video-link width="100%" onmouseover="this.play()" onmouseout="" poster="/thumb/video#{@entry['dict']}/#{@entry['media'][var['_text']]['location']}" data-dict="#{@entry['media'][var['_text']]['main_for_entry']['dict']}" data-entryid="#{@entry['media'][var['_text']]['main_for_entry']['id']}" href=(@search.to_s != ''? "#{@search_path}/#{@entry['media'][var['_text']]['main_for_entry']['id']}" : "/#{@entry['media'][var['_text']]['main_for_entry']['dict']}/show/#{@entry['media'][var['_text']]['main_for_entry']['id']}")
124124
source src="https://files.dictio.info/video#{@entry['dict']}/#{@entry['media'][var['_text']]['location']}" type="video/mp4"
125125
- else
126126
video width="100%" controls="" onmouseover="this.play()" onmouseout="" poster="/thumb/video#{@entry['dict']}/#{@entry['media'][var['_text']]['location']}"
@@ -180,7 +180,7 @@
180180
.video.video--small
181181
.video__content
182182
- if @entry['media'][var['_text']]['main_for_entry']
183-
video.video-link width="100%" onmouseover="this.play()" onmouseout="" poster="/thumb/video#{@entry['dict']}/#{@entry['media'][var['_text']]['location']}" data-url="/#{@entry['media'][var['_text']]['main_for_entry']['dict']}/show/#{@entry['media'][var['_text']]['main_for_entry']['id']}"
183+
video.video-link width="100%" onmouseover="this.play()" onmouseout="" poster="/thumb/video#{@entry['dict']}/#{@entry['media'][var['_text']]['location']}" data-dict="#{@entry['media'][var['_text']]['main_for_entry']['dict']}" data-entryid="#{@entry['media'][var['_text']]['main_for_entry']['id']}" href=(@search.to_s != ''? "#{@search_path}/#{@entry['media'][var['_text']]['main_for_entry']['id']}" : "/#{@entry['media'][var['_text']]['main_for_entry']['dict']}/show/#{@entry['media'][var['_text']]['main_for_entry']['id']}")
184184
source src="https://files.dictio.info/video#{@entry['dict']}/#{@entry['media'][var['_text']]['location']}" type="video/mp4"
185185
- else
186186
video width="100%" controls="" onmouseover="this.play()" onmouseout="" poster="/thumb/video#{@entry['dict']}/#{@entry['media'][var['_text']]['location']}"

0 commit comments

Comments
 (0)