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'))] = ''; $breadcrumb[(empty($linkid) ? __('New link') : __('Edit link'))] = '';
$headers .= $headers .=
"<script type=\"text/javascript\">\n//<![CDATA[ dcPage::jsVars(['dotclear.c2_lang' => $core->auth->getInfo('user_lang')]) .
\$(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::jsLoad(dcPage::getPF('cinecturlink2/js/c2link.js')); dcPage::jsLoad(dcPage::getPF('cinecturlink2/js/c2link.js'));
} }
@ -544,12 +539,12 @@ if ($part == "link") {
'</label></p> '</label></p>
<p><label for="linkurl">' . __('Details URL:') . ' ' . <p><label for="linkurl">' . __('Details URL:') . ' ' .
form::field('linkurl', 60, 255, html::escapeHTML($linkurl), 'maximal') . '</label>' . 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>' . __('Search with Google') . '</a>' .
'</p> '</p>
<p><label for="linkimage">' . __('Image URL:') . ' ' . <p><label for="linkimage">' . __('Image URL:') . ' ' .
form::field('linkimage', 60, 255, html::escapeHTML($linkimage), 'maximal') . '</label>' . 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>' . __('Search with Amazon') . '</a>' .
'</p>'; '</p>';

View File

@ -1,34 +1,22 @@
;if(window.jQuery) (function($){ /*global $, dotclear */
$.fn.openGoogle = function(lang,target){ 'use strict';
return this.each(function(){
$(this).click(function(){ $(function () {
var val = $(target).attr('value'); $('#newlinksearch').on('click', function () {
if (val!=''){ this.href = '';
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'); var val = $('#linktitle').val();
searchwindow.focus(); 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; return false;
}); });
}); $('#newimagesearch').on('click', function () {
} this.href = '';
$.fn.openAmazon = function(lang,target){ var val = $('#linktitle').val();
return this.each(function(){ 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');
$(this).click(function(){ searchwindow.focus();
var val = $(target).attr('value'); return false;
if (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'); $('#newimageselect').on('change', function() {
searchwindow.focus(); $('#linkimage').attr('value', $(this).val());
} });
return false; });
});
});
}
$.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 @@
/* /*global $, dotclear */
$(function() { 'use strict';
// checkboxes selection
$('.checkboxes-helpers').each(function() {
dotclear.checkboxesHelpers(this);
});
});
*/
$(function () { $(function () {
$('.checkboxes-helpers').each(function () { $('.checkboxes-helpers').each(function () {
dotclear.checkboxesHelpers(this, undefined, '#form-entries td input[type=checkbox]', '#form-entries #do-action'); dotclear.checkboxesHelpers(this, undefined, '#form-entries td input[type=checkbox]', '#form-entries #do-action');