diff --git a/Yavsc/wwwroot/js/site.js b/Yavsc/wwwroot/js/site.js index f5ba098d..aef5036d 100755 --- a/Yavsc/wwwroot/js/site.js +++ b/Yavsc/wwwroot/js/site.js @@ -1,35 +1,35 @@ -// Write your Javascript code. - -var allowCircleToBlog = function (e) { - var allow = $(this).prop('checked'); - var circleid = $(this).data('circle-id'); - var targetid = $(this).data('target-id'); - var auth = { CircleId: circleid, BlogPostId: targetid }; - var url = '/api/blogacl'; - if (!allow) url+='/'+circleid; - console.log(auth); - $.ajax({ - url: url, - type: allow?'POST':'DELETE', - data: JSON.stringify(auth), - contentType: "application/json;charset=utf-8", - success: function (data) { - console.log('auth '+allow?'POSTed':'DELETEd'+' Successfully'); - }, - error: function () { - console.log('auth not '+allow?'POSTed':'DELETEd'); - } ++(function($) { + var allowCircleToBlog = function(e) { + var allow = $(this).prop('checked'); + var circleid = $(this).data('circle-id'); + var targetid = $(this).data('target-id'); + var auth = { CircleId: circleid, BlogPostId: targetid }; + var url = '/api/blogacl'; + if (!allow) url += '/' + circleid; + console.log(auth); + $.ajax({ + url: url, + type: allow ? 'POST' : 'DELETE', + data: JSON.stringify(auth), + contentType: "application/json;charset=utf-8", + success: function(data) { + console.log('auth ' + allow ? 'POSTed' : 'DELETEd' + ' Successfully'); + }, + error: function() { + console.log('auth not ' + allow ? 'POSTed' : 'DELETEd'); + } }); - e.preventDefault(); -}; -$(document).ready(function(){ -$('input.Blogcirle[type=checkbox]').on('change',allowCircleToBlog); -} -); + e.preventDefault(); + }; + $(document).ready(function() { + $('input.Blogcirle[type=checkbox]').on('change', allowCircleToBlog); + }); -var notifClick = function(nid) { $.get('/api/dimiss/click/'+nid).done(function() { - }) - .fail(function() { - }) - .always(function() { - }); }; + var notifClick = function(nid) { + if (nid > 0) {  + $.get('/api/dimiss/click/' + nid).done(function() {}) + .fail(function() {}) + .always(function() {}); + } + }; +})(jQuery); \ No newline at end of file