wip: jquery migration

This commit is contained in:
Florian BLOUET
2015-11-23 13:04:20 +01:00
parent 52b06b208e
commit 454f9d4db0
13 changed files with 51 additions and 51 deletions

View File

@@ -2,8 +2,8 @@
"name": "Phraseanet", "name": "Phraseanet",
"version": "3.9.0", "version": "3.9.0",
"dependencies": { "dependencies": {
"jquery": "~1.8.3", "jquery": "~1.11.3",
"jquery-ui": "~1.10.0", "jquery-ui": "~1.10.4",
"jquery-mobile-bower": "~1.3.0", "jquery-mobile-bower": "~1.3.0",
"underscore": "~1.4.4", "underscore": "~1.4.4",
"font-awesome": "~3.0.2", "font-awesome": "~3.0.2",
@@ -39,6 +39,6 @@
"js-fixtures": "https://github.com/badunk/js-fixtures/archive/master.zip" "js-fixtures": "https://github.com/badunk/js-fixtures/archive/master.zip"
}, },
"resolutions": { "resolutions": {
"jquery": "1.8.3" "jquery": "~1.11.3"
} }
} }

View File

@@ -4,6 +4,6 @@ var utils = require('../../utils.js');
gulp.task('build-jquery', function(){ gulp.task('build-jquery', function(){
return utils.buildJsGroup([ return utils.buildJsGroup([
config.paths.vendors + 'jquery/jquery.js' config.paths.vendors + 'jquery/dist/jquery.js'
], 'jquery', 'vendors/jquery'); ], 'jquery', 'vendors/jquery');
}); });

View File

@@ -58,7 +58,7 @@ $(document).ready(function () {
+ ' name="oauth_callback" size="50" type="text"/>' + ' name="oauth_callback" size="50" type="text"/>'
); );
$(".url_callback").die(); $(".url_callback").off();
// save new callback // save new callback
saveBtn.bind("click", function (e) { saveBtn.bind("click", function (e) {
@@ -100,7 +100,7 @@ $(document).ready(function () {
+ ' name="oauth_webhook" size="50" type="text"/>' + ' name="oauth_webhook" size="50" type="text"/>'
); );
$(".url_webhook").die(); $(".url_webhook").off();
// save new callback // save new callback
saveBtn.bind("click", function (e) { saveBtn.bind("click", function (e) {

View File

@@ -21,7 +21,7 @@ $(document).ready(function () {
$.datepicker.setDefaults({showMonthAfterYear: false}); $.datepicker.setDefaults({showMonthAfterYear: false});
$.datepicker.setDefaults($.datepicker.regional[jq_date]); $.datepicker.setDefaults($.datepicker.regional[jq_date]);
$('a.infoDialog,div.infoDialog').live('click', function (event) { $('a.infoDialog,div.infoDialog').on('click', function (event) {
infoDialog($(this)); infoDialog($(this));
}); });
@@ -65,10 +65,10 @@ $(document).ready(function () {
event.stopPropagation(); event.stopPropagation();
}); });
$('#notification_box div.notification').live('mouseover', function () { $('#notification_box div.notification').on('mouseover', function () {
$(this).addClass('hover'); $(this).addClass('hover');
}); });
$('#notification_box div.notification').live('mouseout', function () { $('#notification_box div.notification').on('mouseout', function () {
$(this).removeClass('hover'); $(this).removeClass('hover');
}); });
@@ -481,7 +481,7 @@ function showOverlay(n, appendto, callback, zIndex) {
$('#' + div).css(css).addClass('overlay').fadeTo(500, 0.7).bind('click', function () { $('#' + div).css(css).addClass('overlay').fadeTo(500, 0.7).bind('click', function () {
(callback)(); (callback)();
}); });
if ($.browser.msie && $.browser.version == '6.0') { if (( navigator.userAgent.match(/msie/i) && navigator.userAgent.match(/6/) )) {
$('select').css({ $('select').css({
visibility: 'hidden' visibility: 'hidden'
}); });
@@ -496,7 +496,7 @@ function hideDwnl() {
} }
function hideOverlay(n) { function hideOverlay(n) {
if ($.browser.msie && $.browser.version == '6.0') { if (( navigator.userAgent.match(/msie/i) && navigator.userAgent.match(/6/) )) {
$('select').css({ $('select').css({
visibility: 'visible' visibility: 'visible'
}); });

View File

@@ -22,7 +22,7 @@
// timeout id for delayed tooltips // timeout id for delayed tooltips
tID, tID,
// IE 5.5 or 6 // IE 5.5 or 6
IE = $.browser.msie && (/MSIE\s(5\.5|6\.)/).test(navigator.userAgent), IE = ( navigator.userAgent.match(/msie/i) ) && (/MSIE\s(5\.5|6\.)/).test(navigator.userAgent),
// flag for mouse tracking // flag for mouse tracking
track = false; track = false;

View File

@@ -246,7 +246,7 @@ function display_basket() {
var sc_wrapper = $('#sc_wrapper'); var sc_wrapper = $('#sc_wrapper');
var basket_options = $('#basket_options'); var basket_options = $('#basket_options');
$('.report').live('click',function () { $('.report').on('click',function () {
load_report(); load_report();
return false; return false;
}).addClass('clickable'); }).addClass('clickable');

View File

@@ -3,7 +3,7 @@ $(document).ready(function () {
return; return;
$('.confirm_report').live('click', function () { $('.confirm_report').on('click', function () {
var $this = $(this); var $this = $(this);
$('.loader', $this).css({ $('.loader', $this).css({
@@ -40,7 +40,7 @@ $(document).ready(function () {
}); });
}); });
$('.agreement_radio').live('vmousedown', function () { $('.agreement_radio').on('vmousedown', function () {
var sselcont_id = $(this).attr('for').split('_').pop(); var sselcont_id = $(this).attr('for').split('_').pop();
var agreement = $('#' + $(this).attr('for')).val() == 'yes' ? '1' : '-1'; var agreement = $('#' + $(this).attr('for')).val() == 'yes' ? '1' : '-1';
@@ -84,7 +84,7 @@ $(document).ready(function () {
return false; return false;
}); });
$('.note_area_validate').live('click', function () { $('.note_area_validate').on('click', function () {
var sselcont_id = $(this).closest('form').find('input[name="sselcont_id"]').val(); var sselcont_id = $(this).closest('form').find('input[name="sselcont_id"]').val();
$.mobile.loading(); $.mobile.loading();

View File

@@ -199,7 +199,7 @@
$('.user_content .badges', this.container).disableSelection(); $('.user_content .badges', this.container).disableSelection();
$('.user_content .badges .badge .toggle', this.container).die('click').live('click', function (event) { $('.user_content .badges .badge .toggle', this.container).off('click').on('click', function (event) {
var $this = $(this); var $this = $(this);
@@ -228,7 +228,7 @@
return false; return false;
}); });
$('.user_content .badges .badge .deleter', this.container).live('click', function (event) { $('.user_content .badges .badge .deleter', this.container).on('click', function (event) {
var $elem = $(this).closest('.badge'); var $elem = $(this).closest('.badge');
$elem.fadeOut(function () { $elem.fadeOut(function () {
$elem.remove(); $elem.remove();
@@ -424,7 +424,7 @@
return false; return false;
}); });
$('a.list_sharer', this.container).die('click').live('click', function () { $('a.list_sharer', this.container).off('click').on('click', function () {
var $this = $(this), var $this = $(this),
options = { options = {
@@ -662,7 +662,7 @@
initLeft(); initLeft();
$('.badges a.deleter', this.container).live('click', function () { $('.badges a.deleter', this.container).on('click', function () {
var badge = $(this).closest('.badge'); var badge = $(this).closest('.badge');

View File

@@ -3,7 +3,7 @@
humane.info = humane.spawn({addnCls: 'humane-libnotify-info', timeout: 1000}); humane.info = humane.spawn({addnCls: 'humane-libnotify-info', timeout: 1000});
humane.error = humane.spawn({addnCls: 'humane-libnotify-error', timeout: 1000}); humane.error = humane.spawn({addnCls: 'humane-libnotify-error', timeout: 1000});
$('a.dialog').live('click', function (event) { $('a.dialog').on('click', function (event) {
var $this = $(this), size = 'Medium'; var $this = $(this), size = 'Medium';
if ($this.hasClass('small-dialog')) { if ($this.hasClass('small-dialog')) {

View File

@@ -37,7 +37,7 @@
this.$container.addClass('selectionnable'); this.$container.addClass('selectionnable');
jQuery(this.options.selector, this.$container) jQuery(this.options.selector, this.$container)
.live('click', function (event) { .on('click', function (event) {
if (typeof $this.options.selectStart === 'function') { if (typeof $this.options.selectStart === 'function') {
$this.options.selectStart(jQuery.extend(jQuery.Event('selectStart'), event), $this); $this.options.selectStart(jQuery.extend(jQuery.Event('selectStart'), event), $this);

View File

@@ -66,7 +66,7 @@ var p4 = p4 || {};
}); });
} }
$("#baskets div.content select[name=valid_ord]").live('change', function () { $("#baskets div.content select[name=valid_ord]").on('change', function () {
var active = $('#baskets .SSTT.ui-state-active'); var active = $('#baskets .SSTT.ui-state-active');
if (active.length === 0) { if (active.length === 0) {
return; return;
@@ -531,7 +531,7 @@ var p4 = p4 || {};
$(document).ready(function () { $(document).ready(function () {
activeBaskets(); activeBaskets();
$('a.story_unfix').live('click', function () { $('a.story_unfix').on('click', function () {
unfix($(this).attr('href')); unfix($(this).attr('href'));
return false; return false;

View File

@@ -1017,7 +1017,7 @@ $(document).ready(function () {
} }
}); });
$('.adv_search_button').live('click', function () { $('.adv_search_button').on('click', function () {
var searchForm = $('#searchForm'); var searchForm = $('#searchForm');
var parent = searchForm.parent(); var parent = searchForm.parent();
@@ -1073,7 +1073,7 @@ $(document).ready(function () {
return gogo; return gogo;
}); });
$('.basket_refresher').live('click', function () { $('.basket_refresher').on('click', function () {
return p4.WorkZone.refresh('current'); return p4.WorkZone.refresh('current');
return false; return false;
}); });
@@ -1142,19 +1142,19 @@ $(document).ready(function () {
$(this).highlight('#CCCCCC'); $(this).highlight('#CCCCCC');
}); });
$('#answers .see_more a').live('click', function (event) { $('#answers .see_more a').on('click', function (event) {
$see_more = $(this).closest('.see_more'); $see_more = $(this).closest('.see_more');
$see_more.addClass('loading'); $see_more.addClass('loading');
}); });
$('#answers .feed .entry').live('mouseover', function () { $('#answers .feed .entry').on('mouseover', function () {
$(this).addClass('hover'); $(this).addClass('hover');
}); });
$('#answers .feed .entry').live('mouseout', function () { $('#answers .feed .entry').on('mouseout', function () {
$(this).removeClass('hover'); $(this).removeClass('hover');
}); });
$('a.ajax_answers').live('click', function (event) { $('a.ajax_answers').on('click', function (event) {
event.stopPropagation(); event.stopPropagation();
var $this = $(this); var $this = $(this);
@@ -1201,7 +1201,7 @@ $(document).ready(function () {
}); });
$('a.subscribe_rss').live('click', function (event) { $('a.subscribe_rss').on('click', function (event) {
var $this = $(this); var $this = $(this);
@@ -1258,13 +1258,13 @@ $(document).ready(function () {
return false; return false;
}); });
$('#search_submit').live('mousedown', function (event) { $('#search_submit').on('mousedown', function (event) {
return false; return false;
}); });
$('#history-queries ul li').live('mouseover',function () { $('#history-queries ul li').on('mouseover',function () {
$(this).addClass('hover'); $(this).addClass('hover');
}).live('mouseout', function () { }).on('mouseout', function () {
$(this).removeClass('hover'); $(this).removeClass('hover');
}); });
@@ -1668,17 +1668,17 @@ $(document).ready(function () {
} }
}); });
$('input.input_select_copy').live('focus', function () { $('input.input_select_copy').on('focus', function () {
$(this).select(); $(this).select();
}); });
$('input.input_select_copy').live('blur', function () { $('input.input_select_copy').on('blur', function () {
$(this).deselect(); $(this).deselect();
}); });
$('input.input_select_copy').live('click', function () { $('input.input_select_copy').on('click', function () {
$(this).select(); $(this).select();
}); });
$('#answers .feed .entry a.options').live('click', function () { $('#answers .feed .entry a.options').on('click', function () {
var $this = $(this); var $this = $(this);
$.ajax({ $.ajax({
type: "GET", type: "GET",
@@ -1690,7 +1690,7 @@ $(document).ready(function () {
}); });
return false; return false;
}); });
$('#answers .feed .entry a.feed_delete').live('click', function () { $('#answers .feed .entry a.feed_delete').on('click', function () {
if (!confirm('etes vous sur de vouloir supprimer cette entree ?')) if (!confirm('etes vous sur de vouloir supprimer cette entree ?'))
return false; return false;
var $this = $(this); var $this = $(this);
@@ -1940,7 +1940,7 @@ function toolREFACTOR(datas, activeTab) {
} }
function activeIcons() { function activeIcons() {
$('.TOOL_print_btn').live('click', function () { $('.TOOL_print_btn').on('click', function () {
var value = ""; var value = "";
if ($(this).hasClass('results_window')) { if ($(this).hasClass('results_window')) {
@@ -1979,7 +1979,7 @@ function activeIcons() {
} }
}); });
$('.TOOL_bridge_btn').live('click', function (e) { $('.TOOL_bridge_btn').on('click', function (e) {
e.preventDefault(); e.preventDefault();
var $button = $(this); var $button = $(this);
var datas = {}; var datas = {};
@@ -2021,7 +2021,7 @@ function activeIcons() {
}); });
$('.TOOL_trash_btn').live('click', function () { $('.TOOL_trash_btn').on('click', function () {
var type = ""; var type = "";
var el = false; var el = false;
@@ -2058,7 +2058,7 @@ function activeIcons() {
} }
}); });
$('.TOOL_ppen_btn').live('click', function () { $('.TOOL_ppen_btn').on('click', function () {
var value = ""; var value = "";
var type = ""; var type = "";
@@ -2107,7 +2107,7 @@ function activeIcons() {
} }
}); });
$('.TOOL_publish_btn').live('click', function () { $('.TOOL_publish_btn').on('click', function () {
var value = ""; var value = "";
var type = ""; var type = "";
@@ -2187,7 +2187,7 @@ function activeIcons() {
return; return;
} }
$('.TOOL_chgcoll_btn').live('click', function () { $('.TOOL_chgcoll_btn').on('click', function () {
var value = {}; var value = {};
if ($(this).hasClass('results_window')) { if ($(this).hasClass('results_window')) {
@@ -2228,7 +2228,7 @@ function activeIcons() {
alert(language.nodocselected); alert(language.nodocselected);
}); });
$('.TOOL_chgstatus_btn').live('click', function () { $('.TOOL_chgstatus_btn').on('click', function () {
var params = {}; var params = {};
var $this = $(this); var $this = $(this);
@@ -2266,7 +2266,7 @@ function activeIcons() {
} }
}); });
$('.TOOL_pushdoc_btn').live('click', function () { $('.TOOL_pushdoc_btn').on('click', function () {
var value = "", type = "", sstt_id = "", story = ""; var value = "", type = "", sstt_id = "", story = "";
if ($(this).hasClass('results_window')) { if ($(this).hasClass('results_window')) {
if (p4.Results.Selection.length() > 0) if (p4.Results.Selection.length() > 0)
@@ -2304,7 +2304,7 @@ function activeIcons() {
}); });
$('.TOOL_feedback_btn').live('click', function () { $('.TOOL_feedback_btn').on('click', function () {
var value = "", type = "", sstt_id = "", story = ''; var value = "", type = "", sstt_id = "", story = '';
if ($(this).hasClass('results_window')) { if ($(this).hasClass('results_window')) {
if (p4.Results.Selection.length() > 0) if (p4.Results.Selection.length() > 0)
@@ -2342,7 +2342,7 @@ function activeIcons() {
}); });
$('.TOOL_imgtools_btn').live('click', function () { $('.TOOL_imgtools_btn').on('click', function () {
var datas = {}; var datas = {};
if ($(this).hasClass('results_window')) { if ($(this).hasClass('results_window')) {
@@ -2382,7 +2382,7 @@ function activeIcons() {
}); });
$('.TOOL_disktt_btn').live('click', function () { $('.TOOL_disktt_btn').on('click', function () {
var datas = {}; var datas = {};
if ($(this).hasClass('results_window')) { if ($(this).hasClass('results_window')) {

View File

@@ -41,7 +41,7 @@ function openPreview(env, pos, contId, reload) {
justOpen = true; justOpen = true;
if (!$.browser.msie) { if (!( navigator.userAgent.match(/msie/i))) {
$('#PREVIEWBOX').css({ $('#PREVIEWBOX').css({
'display': 'block', 'display': 'block',
'opacity': 0 'opacity': 0