conjunction OR ++
ajax : keys aren't args any more, because of a+b+c Signed-off-by: bachy <git@g-u-i.net>
This commit is contained in:
@@ -9,7 +9,7 @@ MaterioFlag = function(){
|
||||
* init()
|
||||
*/
|
||||
function init(){
|
||||
trace('MaterioFlag :: init MaterioFlag');
|
||||
//trace('MaterioFlag :: init MaterioFlag');
|
||||
|
||||
buildBlocks();
|
||||
|
||||
@@ -32,36 +32,60 @@ MaterioFlag = function(){
|
||||
};
|
||||
|
||||
function onFlaging(event){
|
||||
trace('MaterioFlag :: onFlaging', event);
|
||||
//trace('MaterioFlag :: onFlaging', event);
|
||||
refreshBlocks();
|
||||
};
|
||||
|
||||
function onResultsUpdated(event){
|
||||
trace('MaterioFlag :: onResultsUpdated', event);
|
||||
//trace('MaterioFlag :: onResultsUpdated', event);
|
||||
ajaxifyLinks(event.container);
|
||||
};
|
||||
|
||||
function buildBlocks(activename){
|
||||
trace('MaterioFlag :: buildBlocks', activename);
|
||||
// nav block
|
||||
$('a.open-list:not(.ajax-processed)', '#block-materio-flag-materio-flag-mylists-nav').each(function(index){
|
||||
$this = $(this)
|
||||
.bind('click', onClickOpenLink)
|
||||
.addClass('ajax-processed');
|
||||
//trace('MaterioFlag :: buildBlocks', activename);
|
||||
|
||||
var name = $this.attr('class').match(/flag_lists_[^_]+_[0-9]+/);
|
||||
// trace('MaterioFlag :: name', name);
|
||||
$('<span class="preview"><i class="icon-eye-open"></i></span>').attr('name', name).insertAfter($this).bind('click', onClickShowPreview);
|
||||
});
|
||||
if($('#block-materio-flag-materio-flag-mybookmarks').length){
|
||||
var type = 'bookmarks';
|
||||
var block = '#block-materio-flag-materio-flag-mybookmarks';
|
||||
}else if($('#block-materio-flag-materio-flag-mylists').length){
|
||||
var type = 'lists';
|
||||
var block = '#block-materio-flag-materio-flag-mylists';
|
||||
}
|
||||
|
||||
if(type == 'lists'){
|
||||
|
||||
// nav block
|
||||
$('a.open-list:not(.ajax-processed)', '#block-materio-flag-materio-flag-mylists-nav').each(function(index){
|
||||
$this = $(this)
|
||||
.bind('click', onClickOpenLink)
|
||||
.addClass('ajax-processed');
|
||||
|
||||
var name = $this.attr('class').match(/flag_lists_[^_]+_[0-9]+/);
|
||||
// trace('MaterioFlag :: name', name);
|
||||
$('<span class="preview"><i class="icon-eye-open"></i></span>').attr('name', name).insertAfter($this).bind('click', onClickShowPreview);
|
||||
});
|
||||
|
||||
// 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);
|
||||
|
||||
// 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);
|
||||
}).addClass('ajax-processed');
|
||||
|
||||
// trigger refresh block event for enabling lazyload images
|
||||
setTimeout(function(){
|
||||
$.event.trigger({
|
||||
type : 'my'+type+'-block-builded',
|
||||
block : block,
|
||||
name : name
|
||||
});
|
||||
},10);
|
||||
|
||||
}
|
||||
|
||||
$('a.open-list', this).bind('click', onClickOpenLink);
|
||||
|
||||
}).addClass('ajax-processed');
|
||||
|
||||
// trace('MaterioFlag :: activename', activename);
|
||||
if(activename == undefined)
|
||||
@@ -70,10 +94,12 @@ MaterioFlag = function(){
|
||||
// trace('MaterioFlag :: activename', activename);
|
||||
if(activename)
|
||||
showPreview(activename);
|
||||
|
||||
|
||||
};
|
||||
|
||||
function refreshBlocks(name){
|
||||
trace('MaterioFlag :: refreshBlocks | name', name);
|
||||
//trace('MaterioFlag :: refreshBlocks | name', name);
|
||||
if($('#block-materio-flag-materio-flag-mybookmarks').length){
|
||||
var type = 'bookmarks';
|
||||
}else if($('#block-materio-flag-materio-flag-mylists').length){
|
||||
@@ -84,7 +110,7 @@ MaterioFlag = function(){
|
||||
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);
|
||||
@@ -102,7 +128,7 @@ MaterioFlag = function(){
|
||||
};
|
||||
|
||||
function ajaxifyLinks(container){
|
||||
trace('MaterioFlag :: ajaxifyLinks', container);
|
||||
//trace('MaterioFlag :: ajaxifyLinks', container);
|
||||
|
||||
container = ((container != null) ? container : 'body');
|
||||
|
||||
@@ -123,12 +149,12 @@ MaterioFlag = function(){
|
||||
* show hide preview
|
||||
*/
|
||||
function onClickShowPreview(event){
|
||||
trace('MaterioFlag :: onClickShowPreview', event);
|
||||
//trace('MaterioFlag :: onClickShowPreview', event);
|
||||
showPreview($(this).attr('name'));
|
||||
};
|
||||
|
||||
function showPreview(name){
|
||||
trace('MaterioFlag :: showPreview', name);
|
||||
//trace('MaterioFlag :: showPreview', name);
|
||||
$('section.'+name, '#block-materio-flag-materio-flag-mylists').addClass('active')
|
||||
.siblings('section').removeClass('active');
|
||||
|
||||
@@ -138,7 +164,7 @@ MaterioFlag = function(){
|
||||
};
|
||||
|
||||
function onClickClosePreview(event){
|
||||
trace('MaterioFlag :: onClickClosePreview', event);
|
||||
//trace('MaterioFlag :: onClickClosePreview', event);
|
||||
eraseCookie('materiomyflaglistsopened');
|
||||
$(this).parents('section.flag-list').removeClass('active');
|
||||
|
||||
@@ -163,7 +189,7 @@ MaterioFlag = function(){
|
||||
$.event.trigger('loading-content');
|
||||
|
||||
$.getJSON(url, {'current_path':document.location.href},function(json){
|
||||
trace('MaterioFlag :: json', json);
|
||||
//trace('MaterioFlag :: json', json);
|
||||
if(json.redirect){
|
||||
window.location = json.redirect;
|
||||
}else{
|
||||
@@ -200,7 +226,7 @@ MaterioFlag = function(){
|
||||
triggerContentChanged();
|
||||
|
||||
}else{
|
||||
trace('MaterioFlag :: no results');
|
||||
//trace('MaterioFlag :: no results');
|
||||
}
|
||||
};
|
||||
|
||||
@@ -222,7 +248,7 @@ MaterioFlag = function(){
|
||||
var url = Drupal.settings.basePath+Drupal.settings.pathPrefix+'materioflag/createlist/form/'+type[0];
|
||||
|
||||
$.getJSON(url, function(json){
|
||||
trace('MaterioFlag :: creat list : json', json);
|
||||
//trace('MaterioFlag :: creat list : json', json);
|
||||
showCreateListForm(json, $link);
|
||||
});
|
||||
return false;
|
||||
@@ -250,7 +276,7 @@ MaterioFlag = function(){
|
||||
event.preventDefault();
|
||||
switch($(this).attr('name')){
|
||||
case 'cancel':
|
||||
trace('MaterioFlag :: cancel',event);
|
||||
//trace('MaterioFlag :: cancel',event);
|
||||
$(this).parents('#modal').remove();
|
||||
|
||||
// google analytics
|
||||
@@ -262,7 +288,7 @@ MaterioFlag = function(){
|
||||
|
||||
break;
|
||||
case 'create':
|
||||
trace('MaterioFlag :: create',event);
|
||||
//trace('MaterioFlag :: create',event);
|
||||
var title = $(this).parents('form').find('input[name*="flag-lists-name"]').val();
|
||||
var type = $(this).parents('form').find('input[name*="type"]').val();
|
||||
|
||||
@@ -288,13 +314,13 @@ MaterioFlag = function(){
|
||||
var url = Drupal.settings.basePath+Drupal.settings.pathPrefix+'flag-lists/add/'+type+'/js';
|
||||
$.getJSON(url, {name:title}, function(data) {
|
||||
if (data.error) {
|
||||
trace(data.error);
|
||||
//trace(data.error);
|
||||
}
|
||||
else {
|
||||
// select.append('<option value="'+data.flag.fid+'">'+data.flag.title+'</option>');
|
||||
// $('input.name', $(this)).val('');
|
||||
// dialog.dialog('close');
|
||||
trace('MaterioFlag :: created list : data', data);
|
||||
//trace('MaterioFlag :: created list : data', data);
|
||||
|
||||
flagEntityWithList(data.flag.name, $link.attr('nid'), $link.attr('token'));
|
||||
$modal.remove();
|
||||
@@ -311,7 +337,7 @@ MaterioFlag = function(){
|
||||
data: { js: true, token: token },
|
||||
dataType: 'json',
|
||||
success: function (data2) {
|
||||
trace('MaterioFlag :: node taged with newly created list : data2', data2)
|
||||
//trace('MaterioFlag :: node taged with newly created list : data2', data2)
|
||||
if (data2.status) {
|
||||
|
||||
// google analytics
|
||||
@@ -379,7 +405,7 @@ MaterioFlag = function(){
|
||||
var url = Drupal.settings.basePath+Drupal.settings.pathPrefix+'materioflag/editlistform/'+type+'/'+lid[0];
|
||||
|
||||
$.getJSON(url, function(json){
|
||||
trace('MaterioFlag :: editlist : json', json);
|
||||
//trace('MaterioFlag :: editlist : json', json);
|
||||
showEditListForm(json, $link);
|
||||
});
|
||||
return false;
|
||||
@@ -413,7 +439,7 @@ MaterioFlag = function(){
|
||||
|
||||
switch($(this).attr('name')){
|
||||
case 'cancel':
|
||||
trace('MaterioFlag :: cancel',event);
|
||||
//trace('MaterioFlag :: cancel',event);
|
||||
$(this).parents('#modal').remove();
|
||||
|
||||
// google analytics
|
||||
@@ -421,7 +447,7 @@ MaterioFlag = function(){
|
||||
|
||||
break;
|
||||
case 'save':
|
||||
trace('MaterioFlag :: create',event);
|
||||
//trace('MaterioFlag :: create',event);
|
||||
|
||||
// google analytics
|
||||
var action = "submit edit form";
|
||||
@@ -429,7 +455,7 @@ MaterioFlag = function(){
|
||||
editList($modal, fid, name, title);
|
||||
break;
|
||||
case 'delete':
|
||||
trace('MaterioFlag :: delete',event);
|
||||
//trace('MaterioFlag :: delete',event);
|
||||
|
||||
if(confirm('Do you realy want to delete the folder '+title+'?')){
|
||||
var action = "submit delete form";
|
||||
@@ -463,7 +489,7 @@ MaterioFlag = function(){
|
||||
alert(data.message);
|
||||
}
|
||||
else {
|
||||
trace('MaterioFlag :: saved list : data', data);
|
||||
//trace('MaterioFlag :: saved list : data', data);
|
||||
|
||||
$.event.trigger({
|
||||
type : 'list-edited',
|
||||
@@ -489,7 +515,7 @@ MaterioFlag = function(){
|
||||
alert(data.message);
|
||||
}
|
||||
else {
|
||||
trace('MaterioFlag :: deleted list : data', data);
|
||||
//trace('MaterioFlag :: deleted list : data', data);
|
||||
|
||||
refreshBlocks();
|
||||
refreshNodeLinks();
|
||||
@@ -527,11 +553,11 @@ MaterioFlag = function(){
|
||||
};
|
||||
|
||||
function loadNextPage(url, $container, target){
|
||||
trace('MaterioFlag :: loadNextPage');
|
||||
//trace('MaterioFlag :: loadNextPage');
|
||||
_isLoadingList = true;
|
||||
$container.addClass('loading');
|
||||
$.getJSON(url, function(json){
|
||||
trace('json', json);
|
||||
//trace('json', json);
|
||||
_isLoadingList = false;
|
||||
$container.removeClass('loading');
|
||||
addNextpage(json, target);
|
||||
|
||||
Reference in New Issue
Block a user