This commit is contained in:
Jean-Christian Paul Denis 2021-10-25 22:43:01 +02:00
parent b09706b58c
commit 12f791bab4
Signed by: JcDenis
GPG Key ID: 1B5B8C5B90B6C951
3 changed files with 28 additions and 50 deletions

View File

@ -287,12 +287,7 @@ if ($part == 'link') {
}
$breadcrumb[(empty($linkid) ? __('New link') : __('Edit link'))] = '';
$headers .=
"<script type=\"text/javascript\">\n//<![CDATA[
\$(function(){if(!document.getElementById){return;}
\$('#newlinksearch').openGoogle('" . $core->auth->getInfo('user_lang') . "','#linktitle');
\$('#newimagesearch').openAmazon('" . $core->auth->getInfo('user_lang') . "','#linktitle');
\$('#newimageselect').fillLink('#linkimage');
});\n//]]>\n</script>\n" .
dcPage::jsVars(['dotclear.c2_lang' => $core->auth->getInfo('user_lang')]) .
dcPage::jsLoad(dcPage::getPF('cinecturlink2/js/c2link.js'));
}
@ -544,12 +539,12 @@ if ($part == "link") {
'</label></p>
<p><label for="linkurl">' . __('Details URL:') . ' ' .
form::field('linkurl', 60, 255, html::escapeHTML($linkurl), 'maximal') . '</label>' .
'<a class="modal" href="http://google.com" id="newlinksearch">' .
'<a class="modal hidden-if-no-js" href="http://google.com" id="newlinksearch">' .
__('Search with Google') . '</a>' .
'</p>
<p><label for="linkimage">' . __('Image URL:') . ' ' .
form::field('linkimage', 60, 255, html::escapeHTML($linkimage), 'maximal') . '</label>' .
'<a class="modal" href="http://amazon.com" id="newimagesearch">' .
'<a class="modal hidden-if-no-js"" href="http://amazon.com" id="newimagesearch">' .
__('Search with Amazon') . '</a>' .
'</p>';

View File

@ -1,34 +1,22 @@
;if(window.jQuery) (function($){
$.fn.openGoogle = function(lang,target){
return this.each(function(){
$(this).click(function(){
var val = $(target).attr('value');
if (val!=''){
searchwindow=window.open('http://www.google.com/search?hl='+lang+'&q='+val,'search','scrollbars=yes,width=800,height=600,resize=yes,toolbar=yes,menubar=yes');
/*global $, dotclear */
'use strict';
$(function () {
$('#newlinksearch').on('click', function () {
this.href = '';
var val = $('#linktitle').val();
searchwindow=window.open('http://www.google.com/search?hl='+dotclear.c2_lang+'&q='+val,'search','scrollbars=yes,width=800,height=600,resize=yes,toolbar=yes,menubar=yes');
searchwindow.focus();
}
return false;
});
});
}
$.fn.openAmazon = function(lang,target){
return this.each(function(){
$(this).click(function(){
var val = $(target).attr('value');
if (val!=''){
$('#newimagesearch').on('click', function () {
this.href = '';
var val = $('#linktitle').val();
searchwindow=window.open('http://www.amazon.fr/exec/obidos/external-search?keyword='+val+'&mode=blended','search','scrollbars=yes,width=800,height=600,resize=yes,toolbar=yes,menubar=yes');
searchwindow.focus();
}
return false;
});
$('#newimageselect').on('change', function() {
$('#linkimage').attr('value', $(this).val());
});
}
$.fn.fillLink = function(target){
return this.each(function(){
$(this).change(function(){
$(target).attr('value',$(this).attr('value'));
return false;
});
});
}
})(jQuery);
});

View File

@ -1,11 +1,6 @@
/*
$(function() {
// checkboxes selection
$('.checkboxes-helpers').each(function() {
dotclear.checkboxesHelpers(this);
});
});
*/
/*global $, dotclear */
'use strict';
$(function () {
$('.checkboxes-helpers').each(function () {
dotclear.checkboxesHelpers(this, undefined, '#form-entries td input[type=checkbox]', '#form-entries #do-action');