diff --git a/index.php b/index.php index 008bcfb..2119d48 100644 --- a/index.php +++ b/index.php @@ -287,12 +287,7 @@ if ($part == 'link') { } $breadcrumb[(empty($linkid) ? __('New link') : __('Edit link'))] = ''; $headers .= - "\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") { '
' . - '' . + ' ' . '
' . - '' . + ' ' . '
'; diff --git a/js/c2link.js b/js/c2link.js index 570fca6..aa19a41 100644 --- a/js/c2link.js +++ b/js/c2link.js @@ -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'); - searchwindow.focus(); - } - return false; - }); - }); - } - $.fn.openAmazon = function(lang,target){ - return this.each(function(){ - $(this).click(function(){ - var val = $(target).attr('value'); - 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'); - searchwindow.focus(); - } - return false; - }); - }); - } - $.fn.fillLink = function(target){ - return this.each(function(){ - $(this).change(function(){ - $(target).attr('value',$(this).attr('value')); - return false; - }); - }); - } -})(jQuery); \ No newline at end of file +/*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; + }); + $('#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()); + }); +}); \ No newline at end of file diff --git a/js/c2links.js b/js/c2links.js index 8320f80..14bc981 100644 --- a/js/c2links.js +++ b/js/c2links.js @@ -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');