merge sandbox with prod
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
// @codekit-prepend "gui.js"
|
||||
// @koala-prepend "gui_ck_fw/gui.js"
|
||||
// @koala-prepend "gui.js"
|
||||
|
||||
|
||||
(function($) {
|
||||
@@ -87,14 +87,14 @@ MaterioFlag = function(){
|
||||
.bind('click', onClickCreatLink)
|
||||
.addClass('ajax-processed');
|
||||
|
||||
|
||||
|
||||
// preview block
|
||||
$('section.flag-list:not(.ajax-processed)', '#block-materio-flag-materio-flag-mylists').each(function(index){
|
||||
var name = $(this).attr('class').match(/flag_lists_[^_]+_[0-9]+/);
|
||||
$('<i class="icon-remove"></i>').appendTo($('h2.listname', this)).attr('name', name).bind('click', onClickClosePreview);
|
||||
|
||||
$('a.open-list', this).bind('click', onClickOpenLink);
|
||||
|
||||
|
||||
}).addClass('ajax-processed');
|
||||
break;
|
||||
}
|
||||
@@ -106,7 +106,7 @@ MaterioFlag = function(){
|
||||
type : 'my'+type+'-block-builded',
|
||||
block : block,
|
||||
name : name
|
||||
});
|
||||
});
|
||||
},10);
|
||||
|
||||
// trace('MaterioFlag :: activename', activename);
|
||||
@@ -115,7 +115,7 @@ MaterioFlag = function(){
|
||||
|
||||
// trace('MaterioFlag :: activename', activename);
|
||||
if(activename)
|
||||
showPreview(activename, block);
|
||||
showPreview(activename, block);
|
||||
};
|
||||
|
||||
function refreshBlocks(name){
|
||||
@@ -125,17 +125,18 @@ MaterioFlag = function(){
|
||||
}else if($('#block-materio-flag-materio-flag-mylists').length){
|
||||
var type = 'lists';
|
||||
}
|
||||
|
||||
|
||||
|
||||
if(type != undefined){
|
||||
var id = '#block-materio-flag-materio-flag-my'+type;
|
||||
var url = Drupal.settings.basePath+Drupal.settings.pathPrefix+'materioflag/refresh/block/'+type;
|
||||
$.getJSON(url, function(json){
|
||||
//trace('MaterioFlag :: block refreshed '+type, json);
|
||||
|
||||
// trace('MaterioFlag :: block refreshed '+type, json);
|
||||
|
||||
$(id).replaceWith(json.block);
|
||||
$('#block-materio-flag-materio-flag-mylists-nav').replaceWith(json.block_nav);
|
||||
|
||||
buildBlocks(name);
|
||||
|
||||
buildBlocks(name);
|
||||
|
||||
$.event.trigger({
|
||||
type : 'my'+type+'-block-updated',
|
||||
@@ -150,7 +151,7 @@ MaterioFlag = function(){
|
||||
//trace('MaterioFlag :: ajaxifyLinks', container);
|
||||
|
||||
container = ((container != null) ? container : 'body');
|
||||
|
||||
|
||||
// trace('MaterioFlag :: typeof Drupal.flagLink', typeof Drupal.flagLink);
|
||||
if (typeof Drupal.flagLink != 'undefined')
|
||||
Drupal.flagLink(container);
|
||||
@@ -162,6 +163,7 @@ MaterioFlag = function(){
|
||||
.addClass('ajax-processed');
|
||||
}
|
||||
|
||||
|
||||
$('a.flag-lists-create:not(.ajax-processed)', container)
|
||||
.bind('click', onClickCreatLink)
|
||||
.addClass('ajax-processed');
|
||||
@@ -189,9 +191,9 @@ MaterioFlag = function(){
|
||||
//trace('MaterioFlag :: onClickClosePreview', event);
|
||||
eraseCookie('materiomyflaglistsopened');
|
||||
if($(this).attr('name') == 'bookmarks'){
|
||||
$(this).parents('.block').find('section.bookmarks').removeClass('active');
|
||||
$(this).parents('.block').find('section.bookmarks').removeClass('active');
|
||||
}else{
|
||||
$(this).parents('section.flag-list').removeClass('active');
|
||||
$(this).parents('section.flag-list').removeClass('active');
|
||||
}
|
||||
|
||||
$.event.trigger('init-layout');
|
||||
@@ -212,7 +214,7 @@ MaterioFlag = function(){
|
||||
function loadList(fid){
|
||||
//trace('MaterioFlag :: loadList | fid', fid);
|
||||
var url = Drupal.settings.basePath+Drupal.settings.pathPrefix+'materioflag/ajax/list/'+fid;
|
||||
|
||||
|
||||
$.event.trigger('loading-content');
|
||||
|
||||
$.getJSON(url, {'current_path':document.location.href},function(json){
|
||||
@@ -229,14 +231,14 @@ MaterioFlag = function(){
|
||||
if(json.rendered){
|
||||
|
||||
$('.inner-content','#content').html(json.rendered);
|
||||
|
||||
|
||||
$.event.trigger('loaded-content');
|
||||
|
||||
|
||||
// no need of ajaxifylinks because it's triggered with resultschanged
|
||||
// ajaxifyLinks('#content');
|
||||
|
||||
var path = Drupal.settings.basePath + Drupal.settings.pathPrefix + json.path;
|
||||
|
||||
|
||||
$.event.trigger({
|
||||
type : 'new-history-page',
|
||||
path : path,
|
||||
@@ -244,10 +246,10 @@ MaterioFlag = function(){
|
||||
content : json.rendered
|
||||
});
|
||||
|
||||
// TODO: change language links for folders
|
||||
// TODO: change language links for folders
|
||||
// for (language in Drupal.settings.materio_search_api_ajax.languages) {
|
||||
// var l = Drupal.settings.materio_search_api_ajax.languages[language];
|
||||
// $('#block-locale-language li.'+language+' a').attr('href', Drupal.settings.basePath + l.prefix+'/' + json.search_path + '/' + json.keys)
|
||||
// $('#block-locale-language li.'+language+' a').attr('href', Drupal.settings.basePath + l.prefix+'/' + json.search_path + '/' + json.keys)
|
||||
// };
|
||||
|
||||
triggerContentChanged();
|
||||
@@ -306,7 +308,7 @@ MaterioFlag = function(){
|
||||
case 'cancel':
|
||||
//trace('MaterioFlag :: cancel',event);
|
||||
$(this).parents('#modal').remove();
|
||||
|
||||
|
||||
// google analytics
|
||||
$.event.trigger({
|
||||
type:"record-stat",
|
||||
@@ -331,11 +333,11 @@ MaterioFlag = function(){
|
||||
createList($modal, type, title, $link);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
})
|
||||
.parents('form').find('input[type="text"]').focus();
|
||||
// TODO: esc keypressed close the form
|
||||
// TODO: esc keypressed close the form
|
||||
};
|
||||
|
||||
function createList($modal, type, title, $link){
|
||||
@@ -363,7 +365,7 @@ MaterioFlag = function(){
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
function flagEntityWithList(name, nid, token){
|
||||
//trace('MaterioFlag :: flagEntityWithList | name', name);
|
||||
// var ret;
|
||||
@@ -376,7 +378,7 @@ MaterioFlag = function(){
|
||||
success: function (data2) {
|
||||
//trace('MaterioFlag :: node taged with newly created list : data2', data2)
|
||||
if (data2.status) {
|
||||
|
||||
|
||||
// google analytics
|
||||
$.event.trigger({
|
||||
type : "record-stat",
|
||||
@@ -408,7 +410,7 @@ MaterioFlag = function(){
|
||||
nids.push($(this).attr('class').match(/node-([0-9]+)/)[1]);
|
||||
});
|
||||
// trace('MaterioFlag :: nids', nids);
|
||||
|
||||
|
||||
var url = Drupal.settings.basePath+Drupal.settings.pathPrefix+'materioflag/nodelinks';
|
||||
$.getJSON(url, {nids:nids.join(";")}, function(data) {
|
||||
// trace('MaterioFlag :: data', data);
|
||||
@@ -419,14 +421,14 @@ MaterioFlag = function(){
|
||||
|
||||
// trace('MaterioFlag :: typeof Drupal.flagLink', typeof Drupal.flagLink);
|
||||
// if (typeof Drupal.flagLink != 'undefined')
|
||||
// Drupal.flagLink($('.node-'+nid+' .flag-lists-entity-links'));
|
||||
|
||||
// Drupal.flagLink($('.node-'+nid+' .flag-lists-entity-links'));
|
||||
|
||||
// TODO: sortir ajaxifyLinks de la boucle, je pense que ça prend trop de ressources
|
||||
ajaxifyLinks('.node-'+nid+' .flag-lists-entity-links');
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
$.event.trigger({
|
||||
type : 'materioflag-nodelinks-updated',
|
||||
nids : nids
|
||||
@@ -438,12 +440,12 @@ MaterioFlag = function(){
|
||||
*/
|
||||
function onCLickEditList(event){
|
||||
//trace('MaterioFlag :: onCLickEditList | event', event);
|
||||
// TODO: empécher le double formulaire
|
||||
// TODO: empécher le double formulaire
|
||||
event.preventDefault();
|
||||
var $link = $(event.currentTarget);
|
||||
var lid = $link.attr('href').match(/[^\/]*$/);
|
||||
var type = 'materiau'; // this is cheap
|
||||
|
||||
|
||||
var url = Drupal.settings.basePath+Drupal.settings.pathPrefix+'materioflag/editlistform/'+type+'/'+lid[0];
|
||||
|
||||
$.getJSON(url, function(json){
|
||||
@@ -483,14 +485,14 @@ MaterioFlag = function(){
|
||||
case 'cancel':
|
||||
//trace('MaterioFlag :: cancel',event);
|
||||
$(this).parents('#modal').remove();
|
||||
|
||||
|
||||
// google analytics
|
||||
var action = 'cancel edit form';
|
||||
var action = 'cancel edit form';
|
||||
|
||||
break;
|
||||
case 'save':
|
||||
//trace('MaterioFlag :: create',event);
|
||||
|
||||
|
||||
// google analytics
|
||||
var action = "submit edit form";
|
||||
|
||||
@@ -501,14 +503,14 @@ MaterioFlag = function(){
|
||||
|
||||
if(confirm('Do you realy want to delete your '+title+' folder ?')){
|
||||
var action = "submit delete form";
|
||||
deleteList($modal, fid);
|
||||
deleteList($modal, fid);
|
||||
}else{
|
||||
var action = "cancel delete form";
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
// google analytics
|
||||
$.event.trigger({
|
||||
type:"record-stat",
|
||||
@@ -519,7 +521,7 @@ MaterioFlag = function(){
|
||||
return false;
|
||||
})
|
||||
.parents('form').find('input[type="text"]').focus();
|
||||
// TODO: esc keypressed close the form
|
||||
// TODO: esc keypressed close the form
|
||||
};
|
||||
|
||||
function saveList($modal, fid, name, title){
|
||||
@@ -536,7 +538,7 @@ MaterioFlag = function(){
|
||||
}
|
||||
else {
|
||||
//trace('MaterioFlag :: saved list : data', data);
|
||||
|
||||
|
||||
$.event.trigger({
|
||||
type : 'list-edited',
|
||||
name : data.listname,
|
||||
@@ -625,7 +627,7 @@ MaterioFlag = function(){
|
||||
var $newcontent = $(json.rendered),
|
||||
$newitems = $(container_class, $newcontent).children('article').addClass('just-added'),
|
||||
$newpager = $('ul.pager', $newcontent);
|
||||
|
||||
|
||||
$(container_class, '#content').append($newitems);
|
||||
$('ul.pager', '#content').replaceWith($newpager.hide());
|
||||
|
||||
@@ -670,8 +672,8 @@ MaterioFlag = function(){
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* cookies
|
||||
/**
|
||||
* cookies
|
||||
*/
|
||||
function createCookie(name,value,days) {
|
||||
if (days) {
|
||||
@@ -700,10 +702,12 @@ MaterioFlag = function(){
|
||||
|
||||
|
||||
init();
|
||||
|
||||
|
||||
};
|
||||
|
||||
$(document).ready(function() {
|
||||
var materioflag = new MaterioFlag();
|
||||
});
|
||||
|
||||
|
||||
})(jQuery);
|
94
js/materio_flag.min.js
vendored
94
js/materio_flag.min.js
vendored
@@ -9,8 +9,8 @@
|
||||
function trace(s,o){
|
||||
if(window.console && window.console.debug){
|
||||
arguments.length === 2 ? window.console.debug(s,o) : window.console.debug(s);
|
||||
}else if(window.console && window.console.log){
|
||||
arguments.length === 2 ? window.console.log(s,o) : window.console.log(s);
|
||||
}else if(console && console.log){
|
||||
arguments.length === 2 ? console.log(s,o) : console.log(s);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -30,7 +30,7 @@ function loadjscssfile(filename, filetype){
|
||||
}
|
||||
if (typeof fileref!="undefined")
|
||||
document.getElementsByTagName("head")[0].appendChild(fileref)
|
||||
}
|
||||
};
|
||||
|
||||
// ------ TIMEOUT
|
||||
|
||||
@@ -369,7 +369,7 @@ function getElementAngle(x1, y1, x2, y2) {
|
||||
|
||||
|
||||
// @codekit-prepend "gui.js"
|
||||
// @koala-prepend "gui_ck_fw/gui.js"
|
||||
// @koala-prepend "gui.js"
|
||||
|
||||
|
||||
(function($) {
|
||||
@@ -457,14 +457,14 @@ MaterioFlag = function(){
|
||||
.bind('click', onClickCreatLink)
|
||||
.addClass('ajax-processed');
|
||||
|
||||
|
||||
|
||||
// preview block
|
||||
$('section.flag-list:not(.ajax-processed)', '#block-materio-flag-materio-flag-mylists').each(function(index){
|
||||
var name = $(this).attr('class').match(/flag_lists_[^_]+_[0-9]+/);
|
||||
$('<i class="icon-remove"></i>').appendTo($('h2.listname', this)).attr('name', name).bind('click', onClickClosePreview);
|
||||
|
||||
$('a.open-list', this).bind('click', onClickOpenLink);
|
||||
|
||||
|
||||
}).addClass('ajax-processed');
|
||||
break;
|
||||
}
|
||||
@@ -476,7 +476,7 @@ MaterioFlag = function(){
|
||||
type : 'my'+type+'-block-builded',
|
||||
block : block,
|
||||
name : name
|
||||
});
|
||||
});
|
||||
},10);
|
||||
|
||||
// trace('MaterioFlag :: activename', activename);
|
||||
@@ -485,7 +485,7 @@ MaterioFlag = function(){
|
||||
|
||||
// trace('MaterioFlag :: activename', activename);
|
||||
if(activename)
|
||||
showPreview(activename, block);
|
||||
showPreview(activename, block);
|
||||
};
|
||||
|
||||
function refreshBlocks(name){
|
||||
@@ -495,17 +495,18 @@ MaterioFlag = function(){
|
||||
}else if($('#block-materio-flag-materio-flag-mylists').length){
|
||||
var type = 'lists';
|
||||
}
|
||||
|
||||
|
||||
|
||||
if(type != undefined){
|
||||
var id = '#block-materio-flag-materio-flag-my'+type;
|
||||
var url = Drupal.settings.basePath+Drupal.settings.pathPrefix+'materioflag/refresh/block/'+type;
|
||||
$.getJSON(url, function(json){
|
||||
//trace('MaterioFlag :: block refreshed '+type, json);
|
||||
|
||||
// trace('MaterioFlag :: block refreshed '+type, json);
|
||||
|
||||
$(id).replaceWith(json.block);
|
||||
$('#block-materio-flag-materio-flag-mylists-nav').replaceWith(json.block_nav);
|
||||
|
||||
buildBlocks(name);
|
||||
|
||||
buildBlocks(name);
|
||||
|
||||
$.event.trigger({
|
||||
type : 'my'+type+'-block-updated',
|
||||
@@ -520,7 +521,7 @@ MaterioFlag = function(){
|
||||
//trace('MaterioFlag :: ajaxifyLinks', container);
|
||||
|
||||
container = ((container != null) ? container : 'body');
|
||||
|
||||
|
||||
// trace('MaterioFlag :: typeof Drupal.flagLink', typeof Drupal.flagLink);
|
||||
if (typeof Drupal.flagLink != 'undefined')
|
||||
Drupal.flagLink(container);
|
||||
@@ -532,6 +533,7 @@ MaterioFlag = function(){
|
||||
.addClass('ajax-processed');
|
||||
}
|
||||
|
||||
|
||||
$('a.flag-lists-create:not(.ajax-processed)', container)
|
||||
.bind('click', onClickCreatLink)
|
||||
.addClass('ajax-processed');
|
||||
@@ -559,9 +561,9 @@ MaterioFlag = function(){
|
||||
//trace('MaterioFlag :: onClickClosePreview', event);
|
||||
eraseCookie('materiomyflaglistsopened');
|
||||
if($(this).attr('name') == 'bookmarks'){
|
||||
$(this).parents('.block').find('section.bookmarks').removeClass('active');
|
||||
$(this).parents('.block').find('section.bookmarks').removeClass('active');
|
||||
}else{
|
||||
$(this).parents('section.flag-list').removeClass('active');
|
||||
$(this).parents('section.flag-list').removeClass('active');
|
||||
}
|
||||
|
||||
$.event.trigger('init-layout');
|
||||
@@ -582,7 +584,7 @@ MaterioFlag = function(){
|
||||
function loadList(fid){
|
||||
//trace('MaterioFlag :: loadList | fid', fid);
|
||||
var url = Drupal.settings.basePath+Drupal.settings.pathPrefix+'materioflag/ajax/list/'+fid;
|
||||
|
||||
|
||||
$.event.trigger('loading-content');
|
||||
|
||||
$.getJSON(url, {'current_path':document.location.href},function(json){
|
||||
@@ -599,14 +601,14 @@ MaterioFlag = function(){
|
||||
if(json.rendered){
|
||||
|
||||
$('.inner-content','#content').html(json.rendered);
|
||||
|
||||
|
||||
$.event.trigger('loaded-content');
|
||||
|
||||
|
||||
// no need of ajaxifylinks because it's triggered with resultschanged
|
||||
// ajaxifyLinks('#content');
|
||||
|
||||
var path = Drupal.settings.basePath + Drupal.settings.pathPrefix + json.path;
|
||||
|
||||
|
||||
$.event.trigger({
|
||||
type : 'new-history-page',
|
||||
path : path,
|
||||
@@ -614,10 +616,10 @@ MaterioFlag = function(){
|
||||
content : json.rendered
|
||||
});
|
||||
|
||||
// TODO: change language links for folders
|
||||
// TODO: change language links for folders
|
||||
// for (language in Drupal.settings.materio_search_api_ajax.languages) {
|
||||
// var l = Drupal.settings.materio_search_api_ajax.languages[language];
|
||||
// $('#block-locale-language li.'+language+' a').attr('href', Drupal.settings.basePath + l.prefix+'/' + json.search_path + '/' + json.keys)
|
||||
// $('#block-locale-language li.'+language+' a').attr('href', Drupal.settings.basePath + l.prefix+'/' + json.search_path + '/' + json.keys)
|
||||
// };
|
||||
|
||||
triggerContentChanged();
|
||||
@@ -676,7 +678,7 @@ MaterioFlag = function(){
|
||||
case 'cancel':
|
||||
//trace('MaterioFlag :: cancel',event);
|
||||
$(this).parents('#modal').remove();
|
||||
|
||||
|
||||
// google analytics
|
||||
$.event.trigger({
|
||||
type:"record-stat",
|
||||
@@ -701,11 +703,11 @@ MaterioFlag = function(){
|
||||
createList($modal, type, title, $link);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
})
|
||||
.parents('form').find('input[type="text"]').focus();
|
||||
// TODO: esc keypressed close the form
|
||||
// TODO: esc keypressed close the form
|
||||
};
|
||||
|
||||
function createList($modal, type, title, $link){
|
||||
@@ -733,7 +735,7 @@ MaterioFlag = function(){
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
function flagEntityWithList(name, nid, token){
|
||||
//trace('MaterioFlag :: flagEntityWithList | name', name);
|
||||
// var ret;
|
||||
@@ -746,7 +748,7 @@ MaterioFlag = function(){
|
||||
success: function (data2) {
|
||||
//trace('MaterioFlag :: node taged with newly created list : data2', data2)
|
||||
if (data2.status) {
|
||||
|
||||
|
||||
// google analytics
|
||||
$.event.trigger({
|
||||
type : "record-stat",
|
||||
@@ -778,7 +780,7 @@ MaterioFlag = function(){
|
||||
nids.push($(this).attr('class').match(/node-([0-9]+)/)[1]);
|
||||
});
|
||||
// trace('MaterioFlag :: nids', nids);
|
||||
|
||||
|
||||
var url = Drupal.settings.basePath+Drupal.settings.pathPrefix+'materioflag/nodelinks';
|
||||
$.getJSON(url, {nids:nids.join(";")}, function(data) {
|
||||
// trace('MaterioFlag :: data', data);
|
||||
@@ -789,14 +791,14 @@ MaterioFlag = function(){
|
||||
|
||||
// trace('MaterioFlag :: typeof Drupal.flagLink', typeof Drupal.flagLink);
|
||||
// if (typeof Drupal.flagLink != 'undefined')
|
||||
// Drupal.flagLink($('.node-'+nid+' .flag-lists-entity-links'));
|
||||
|
||||
// Drupal.flagLink($('.node-'+nid+' .flag-lists-entity-links'));
|
||||
|
||||
// TODO: sortir ajaxifyLinks de la boucle, je pense que ça prend trop de ressources
|
||||
ajaxifyLinks('.node-'+nid+' .flag-lists-entity-links');
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
$.event.trigger({
|
||||
type : 'materioflag-nodelinks-updated',
|
||||
nids : nids
|
||||
@@ -808,12 +810,12 @@ MaterioFlag = function(){
|
||||
*/
|
||||
function onCLickEditList(event){
|
||||
//trace('MaterioFlag :: onCLickEditList | event', event);
|
||||
// TODO: empécher le double formulaire
|
||||
// TODO: empécher le double formulaire
|
||||
event.preventDefault();
|
||||
var $link = $(event.currentTarget);
|
||||
var lid = $link.attr('href').match(/[^\/]*$/);
|
||||
var type = 'materiau'; // this is cheap
|
||||
|
||||
|
||||
var url = Drupal.settings.basePath+Drupal.settings.pathPrefix+'materioflag/editlistform/'+type+'/'+lid[0];
|
||||
|
||||
$.getJSON(url, function(json){
|
||||
@@ -853,14 +855,14 @@ MaterioFlag = function(){
|
||||
case 'cancel':
|
||||
//trace('MaterioFlag :: cancel',event);
|
||||
$(this).parents('#modal').remove();
|
||||
|
||||
|
||||
// google analytics
|
||||
var action = 'cancel edit form';
|
||||
var action = 'cancel edit form';
|
||||
|
||||
break;
|
||||
case 'save':
|
||||
//trace('MaterioFlag :: create',event);
|
||||
|
||||
|
||||
// google analytics
|
||||
var action = "submit edit form";
|
||||
|
||||
@@ -871,14 +873,14 @@ MaterioFlag = function(){
|
||||
|
||||
if(confirm('Do you realy want to delete your '+title+' folder ?')){
|
||||
var action = "submit delete form";
|
||||
deleteList($modal, fid);
|
||||
deleteList($modal, fid);
|
||||
}else{
|
||||
var action = "cancel delete form";
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
// google analytics
|
||||
$.event.trigger({
|
||||
type:"record-stat",
|
||||
@@ -889,7 +891,7 @@ MaterioFlag = function(){
|
||||
return false;
|
||||
})
|
||||
.parents('form').find('input[type="text"]').focus();
|
||||
// TODO: esc keypressed close the form
|
||||
// TODO: esc keypressed close the form
|
||||
};
|
||||
|
||||
function saveList($modal, fid, name, title){
|
||||
@@ -906,7 +908,7 @@ MaterioFlag = function(){
|
||||
}
|
||||
else {
|
||||
//trace('MaterioFlag :: saved list : data', data);
|
||||
|
||||
|
||||
$.event.trigger({
|
||||
type : 'list-edited',
|
||||
name : data.listname,
|
||||
@@ -995,7 +997,7 @@ MaterioFlag = function(){
|
||||
var $newcontent = $(json.rendered),
|
||||
$newitems = $(container_class, $newcontent).children('article').addClass('just-added'),
|
||||
$newpager = $('ul.pager', $newcontent);
|
||||
|
||||
|
||||
$(container_class, '#content').append($newitems);
|
||||
$('ul.pager', '#content').replaceWith($newpager.hide());
|
||||
|
||||
@@ -1040,8 +1042,8 @@ MaterioFlag = function(){
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* cookies
|
||||
/**
|
||||
* cookies
|
||||
*/
|
||||
function createCookie(name,value,days) {
|
||||
if (days) {
|
||||
@@ -1070,10 +1072,12 @@ MaterioFlag = function(){
|
||||
|
||||
|
||||
init();
|
||||
|
||||
|
||||
};
|
||||
|
||||
$(document).ready(function() {
|
||||
var materioflag = new MaterioFlag();
|
||||
});
|
||||
|
||||
|
||||
})(jQuery);
|
@@ -4,7 +4,7 @@
|
||||
(function($) {
|
||||
|
||||
MaterioUser = function(){
|
||||
|
||||
|
||||
var _isAdhesion = $('body').is('.page-node-11187') || $('body').is('.page-node-11186');
|
||||
|
||||
function init() {
|
||||
@@ -17,7 +17,7 @@ MaterioUser = function(){
|
||||
// trace('initAdhesion');
|
||||
$('.get-link a').bind('click', function(event) {
|
||||
// trace('get-link click');
|
||||
|
||||
|
||||
// do not show the registration form if already logged-in
|
||||
if($('body').is('.logged-in'))
|
||||
return true;
|
||||
@@ -29,7 +29,7 @@ MaterioUser = function(){
|
||||
href = $this.attr("href"),
|
||||
destination = href.match('/\?destination=([^,]+)');
|
||||
|
||||
destination = "/" + destination[1].replace('%23', '#');
|
||||
destination = "/" + destination[1].replace('%23', '#');
|
||||
destination = destination.replace('//', '/');
|
||||
// trace('destination', destination);
|
||||
|
||||
@@ -55,7 +55,7 @@ MaterioUser = function(){
|
||||
function formLoaded(json, destination){
|
||||
//trace('formLoaded | json', json);
|
||||
var $modal = $('<div>').addClass('modal-content').append(json.block);
|
||||
|
||||
|
||||
var id,label, description;
|
||||
$('input.form-text', $modal).each(function(i) {
|
||||
id = $(this).attr('id');
|
||||
@@ -83,11 +83,16 @@ MaterioUser = function(){
|
||||
|
||||
$("#user-register-form #edit-submit, #user-register-form #edit-submit--2", $modal).click(function(event){
|
||||
event.preventDefault();
|
||||
|
||||
// disable submit button to avoid duplicate user creation
|
||||
// console.log('click', this);
|
||||
$(this).attr('disabled', 'true');
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
dataType:'json',
|
||||
url: Drupal.settings.basePath+Drupal.settings.pathPrefix+"materio_user/register/submit",
|
||||
data: $('#user-register-form', $modal).serialize(),
|
||||
data: $('#user-register-form', $modal).serialize(),
|
||||
success: function(data) { onUserLoginRegisterSubmit($('#user-register-form'), data, destination);},
|
||||
error: function(jqXHR, textStatus, errorThrown) { trace('error : '+textStatus+' | '+errorThrown); }
|
||||
});
|
||||
@@ -100,14 +105,14 @@ MaterioUser = function(){
|
||||
type: 'POST',
|
||||
dataType:'json',
|
||||
url: Drupal.settings.basePath+Drupal.settings.pathPrefix+"materio_user/login/submit",
|
||||
data: $('#user-login', $modal).serialize(),
|
||||
data: $('#user-login', $modal).serialize(),
|
||||
success: function(data){ onUserLoginRegisterSubmit($('#user-login'), data, destination); },
|
||||
error: function(jqXHR, textStatus, errorThrown) { trace('error : '+textStatus+' | '+errorThrown); }
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
// google analytics
|
||||
// google analytics
|
||||
// $.event.trigger({
|
||||
// type : "record-stat",
|
||||
// categorie : 'Search',
|
||||
@@ -120,12 +125,21 @@ MaterioUser = function(){
|
||||
};
|
||||
|
||||
function onUserLoginRegisterSubmit($form, data, destination){
|
||||
// console.log('data', data);
|
||||
cleanModalErrors();
|
||||
if(data.errors != null){
|
||||
for(field in data.errors){
|
||||
$('input[name='+field+']', $form).addClass('error');
|
||||
$form.prepend($('<div>').addClass('message-error').html(data.errors[field]));
|
||||
}
|
||||
|
||||
(function($form){
|
||||
setTimeout(function(){
|
||||
console.log('enabled');
|
||||
$('input[type=submit]', $form).removeAttr('disabled');
|
||||
}, 0.5*1000);
|
||||
})($form);
|
||||
|
||||
}else{
|
||||
// trace('destination = '+destination);
|
||||
window.location.pathname = destination;
|
||||
@@ -143,5 +157,5 @@ MaterioUser = function(){
|
||||
$(document).ready(function() {
|
||||
var materiouser = new MaterioUser();
|
||||
});
|
||||
|
||||
|
||||
})(jQuery);
|
30
js/materio_user.min.js
vendored
30
js/materio_user.min.js
vendored
@@ -374,7 +374,7 @@ function getElementAngle(x1, y1, x2, y2) {
|
||||
(function($) {
|
||||
|
||||
MaterioUser = function(){
|
||||
|
||||
|
||||
var _isAdhesion = $('body').is('.page-node-11187') || $('body').is('.page-node-11186');
|
||||
|
||||
function init() {
|
||||
@@ -387,7 +387,7 @@ MaterioUser = function(){
|
||||
// trace('initAdhesion');
|
||||
$('.get-link a').bind('click', function(event) {
|
||||
// trace('get-link click');
|
||||
|
||||
|
||||
// do not show the registration form if already logged-in
|
||||
if($('body').is('.logged-in'))
|
||||
return true;
|
||||
@@ -399,7 +399,7 @@ MaterioUser = function(){
|
||||
href = $this.attr("href"),
|
||||
destination = href.match('/\?destination=([^,]+)');
|
||||
|
||||
destination = "/" + destination[1].replace('%23', '#');
|
||||
destination = "/" + destination[1].replace('%23', '#');
|
||||
destination = destination.replace('//', '/');
|
||||
// trace('destination', destination);
|
||||
|
||||
@@ -425,7 +425,7 @@ MaterioUser = function(){
|
||||
function formLoaded(json, destination){
|
||||
//trace('formLoaded | json', json);
|
||||
var $modal = $('<div>').addClass('modal-content').append(json.block);
|
||||
|
||||
|
||||
var id,label, description;
|
||||
$('input.form-text', $modal).each(function(i) {
|
||||
id = $(this).attr('id');
|
||||
@@ -453,11 +453,16 @@ MaterioUser = function(){
|
||||
|
||||
$("#user-register-form #edit-submit, #user-register-form #edit-submit--2", $modal).click(function(event){
|
||||
event.preventDefault();
|
||||
|
||||
// disable submit button to avoid duplicate user creation
|
||||
// console.log('click', this);
|
||||
$(this).attr('disabled', 'true');
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
dataType:'json',
|
||||
url: Drupal.settings.basePath+Drupal.settings.pathPrefix+"materio_user/register/submit",
|
||||
data: $('#user-register-form', $modal).serialize(),
|
||||
data: $('#user-register-form', $modal).serialize(),
|
||||
success: function(data) { onUserLoginRegisterSubmit($('#user-register-form'), data, destination);},
|
||||
error: function(jqXHR, textStatus, errorThrown) { trace('error : '+textStatus+' | '+errorThrown); }
|
||||
});
|
||||
@@ -470,14 +475,14 @@ MaterioUser = function(){
|
||||
type: 'POST',
|
||||
dataType:'json',
|
||||
url: Drupal.settings.basePath+Drupal.settings.pathPrefix+"materio_user/login/submit",
|
||||
data: $('#user-login', $modal).serialize(),
|
||||
data: $('#user-login', $modal).serialize(),
|
||||
success: function(data){ onUserLoginRegisterSubmit($('#user-login'), data, destination); },
|
||||
error: function(jqXHR, textStatus, errorThrown) { trace('error : '+textStatus+' | '+errorThrown); }
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
// google analytics
|
||||
// google analytics
|
||||
// $.event.trigger({
|
||||
// type : "record-stat",
|
||||
// categorie : 'Search',
|
||||
@@ -490,12 +495,21 @@ MaterioUser = function(){
|
||||
};
|
||||
|
||||
function onUserLoginRegisterSubmit($form, data, destination){
|
||||
// console.log('data', data);
|
||||
cleanModalErrors();
|
||||
if(data.errors != null){
|
||||
for(field in data.errors){
|
||||
$('input[name='+field+']', $form).addClass('error');
|
||||
$form.prepend($('<div>').addClass('message-error').html(data.errors[field]));
|
||||
}
|
||||
|
||||
(function($form){
|
||||
setTimeout(function(){
|
||||
console.log('enabled');
|
||||
$('input[type=submit]', $form).removeAttr('disabled');
|
||||
}, 0.5*1000);
|
||||
})($form);
|
||||
|
||||
}else{
|
||||
// trace('destination = '+destination);
|
||||
window.location.pathname = destination;
|
||||
@@ -513,5 +527,5 @@ MaterioUser = function(){
|
||||
$(document).ready(function() {
|
||||
var materiouser = new MaterioUser();
|
||||
});
|
||||
|
||||
|
||||
})(jQuery);
|
Reference in New Issue
Block a user