Merge from totem
This commit is contained in:
parent
debd1c32a7
commit
c466aed242
64 changed files with 3820 additions and 171 deletions
|
|
@ -1,6 +1,7 @@
|
|||
var Yavsc = (function(apiBaseUrl){
|
||||
var self = {};
|
||||
|
||||
var $notifications = $('#notifications');
|
||||
function dumpprops(obj) {
|
||||
var str = "";
|
||||
for(var k in obj)
|
||||
|
|
@ -29,13 +30,29 @@ self.dimiss = function () {
|
|||
$(this).parent().remove();
|
||||
};
|
||||
|
||||
self.onScroll = function() {
|
||||
if ($notifications.has('*').length>0) {
|
||||
if ($(window).scrollTop()>375) {
|
||||
console.log('fixit');
|
||||
$notifications.css('position','fixed');
|
||||
$notifications.css('z-index',2);
|
||||
$notifications.css('top',0);
|
||||
}
|
||||
else {
|
||||
$notifications.css('position','static');
|
||||
$notifications.css('z-index',1);
|
||||
}}
|
||||
};
|
||||
|
||||
self.notice = function (msg, msgok) {
|
||||
if (!msgok) msgok='Ok';
|
||||
if (msg) {
|
||||
var note = $('<div class="notification">'+msg+'<br></div>');
|
||||
$('<a class="actionlink"><i class="fa fa-check">'+msgok+'</i></a>').click(self.dimiss).appendTo(note);
|
||||
note.appendTo("#notifications");
|
||||
} };
|
||||
self.onScroll();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
self.onAjaxBadInput = function (data)
|
||||
|
|
@ -59,8 +76,29 @@ self.onAjaxError = function (xhr, ajaxOptions, thrownError) {
|
|||
Yavsc.notice(xhr.status+" : "+xhr.responseText);
|
||||
};
|
||||
|
||||
return self;
|
||||
})();
|
||||
$(document).ready(function(){
|
||||
|
||||
$('.maskable').each( function() {
|
||||
var $mobj = $(this);
|
||||
var $btnshow = $('#'+$mobj.data('btn-show'));
|
||||
var $btnhide = $('#'+$mobj.data('btn-hide'));
|
||||
var onClickHide = function(){
|
||||
$mobj.addClass('hidden');
|
||||
$btnshow.removeClass('hidden');
|
||||
$btnhide.addClass('hidden');
|
||||
};
|
||||
$btnhide.click(onClickHide);
|
||||
onClickHide();
|
||||
$btnshow.click(function(){
|
||||
$mobj.removeClass('hidden');
|
||||
$btnshow.addClass('hidden');
|
||||
$btnhide.removeClass('hidden');
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
$(document).ready(function(){
|
||||
|
|
@ -70,20 +108,11 @@ $(document).on({
|
|||
ajaxStart: function() { $body.addClass("loading"); },
|
||||
ajaxStop: function() { $body.removeClass("loading"); }
|
||||
});
|
||||
|
||||
var $window = $(window);
|
||||
$(window).scroll(function() {
|
||||
var $ns = $('#notifications');
|
||||
if ($ns.has('*').length>0) {
|
||||
if ($window.scrollTop()>375) {
|
||||
$ns.css('position','fixed');
|
||||
$ns.css('z-index',2);
|
||||
$ns.css('top',0);
|
||||
}
|
||||
else {
|
||||
$ns.css('position','static');
|
||||
$ns.css('z-index',1);
|
||||
}}
|
||||
});
|
||||
$(window).scroll(self.onScroll);
|
||||
});
|
||||
|
||||
|
||||
|
||||
return self;
|
||||
})();
|
||||
|
||||
|
|
|
|||
|
|
@ -3,23 +3,29 @@ var self = {};
|
|||
self.blogsApiUrl = (apiBaseUrl || '/api') + "/Blogs";
|
||||
|
||||
self.tag = function (postid,tagname,callback) {
|
||||
|
||||
var data = {
|
||||
postid: postid,
|
||||
tag: tagname
|
||||
};
|
||||
$.ajax({
|
||||
url: CirclesApiUrl+"/Tag",
|
||||
type: "POST",
|
||||
data: { postid: postid, tag: tagname },
|
||||
success: function () {
|
||||
if (callback) callback(postid,tagname);
|
||||
},
|
||||
statusCode: {
|
||||
url: '/api/Blogs/Tag/',
|
||||
type: 'POST',
|
||||
data: data,
|
||||
success: function() {
|
||||
if (callback) callback(postid,tagname);
|
||||
},
|
||||
statusCode: {
|
||||
400: Yavsc.onAjaxBadInput
|
||||
},
|
||||
error: Yavsc.onAjaxError});
|
||||
}
|
||||
error: Yavsc.onAjaxError
|
||||
});
|
||||
};
|
||||
self.untag = function (postid,tagname,callback) {
|
||||
$.ajax({
|
||||
url: CirclesApiUrl+"/Untag",
|
||||
url: self.blogsApiUrl+"/Untag/"+postid,
|
||||
type: "POST",
|
||||
data: { postid: postid, tag: tagname },
|
||||
data: { postid: postid, tag: tagname },
|
||||
success: function () {
|
||||
if (callback) callback(postid,tagname);
|
||||
},
|
||||
|
|
@ -27,6 +33,42 @@ self.untag = function (postid,tagname,callback) {
|
|||
400: Yavsc.onAjaxBadInput
|
||||
},
|
||||
error: Yavsc.onAjaxError});
|
||||
};
|
||||
$(document).ready(function(){
|
||||
|
||||
|
||||
$('.tagname').click(function (){
|
||||
var postid=$(this).parent().data('postid');
|
||||
var $thistag = $(this);
|
||||
// assert (postid); : all tagname class element
|
||||
// are related to a data-postid html attribute,
|
||||
// found on their parent element
|
||||
self.untag(postid, $thistag.text(), function () { $thistag.remove(); } );
|
||||
}
|
||||
);
|
||||
$('.taginput').autocomplete({
|
||||
minLength: 0,
|
||||
delay: 200,
|
||||
source: function( request, response ) {
|
||||
$.ajax({
|
||||
url: "/api/Blogs/Tags",
|
||||
type: "POST",
|
||||
data: {
|
||||
pattern: request.term
|
||||
},
|
||||
success: function( data ) {
|
||||
response( data );
|
||||
}
|
||||
});
|
||||
},
|
||||
open: function() {
|
||||
$( this ).removeClass( "ui-corner-all" ).addClass( "ui-corner-top" );
|
||||
},
|
||||
close: function() {
|
||||
$( this ).removeClass( "ui-corner-top" ).addClass( "ui-corner-all" );
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
return self;
|
||||
})();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue