files tree made better.

This commit is contained in:
2019-01-01 16:28:47 +00:00
parent cb96933a25
commit 5b8e9b3975
1633 changed files with 18220 additions and 41869 deletions

2364
src/Yavsc/wwwroot/js/bootstrap.js vendored Normal file

File diff suppressed because it is too large Load Diff

1
src/Yavsc/wwwroot/js/bootstrap.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,184 @@
+(function ($) {
var pvuis
var audio = new Audio('/sounds/bell.mp3')
function addULI (uname, cxids) {
$('<li class="user"><button><img src="/Avatars/' + uname + '.xs.png"> ' + uname + '</button></li>')
.data('name', uname)
.data('cxids', cxids)
.css('cursor', 'pointer')
.click(function () { setPrivate(this); })
.appendTo('#userlist')
}
function getUsers () {
$('#userlist').empty()
$('#to').empty()
$.get('/api/chat/users').done(
function (users) {
$.each(users, function () {
var user = this
var existent = $('#userlist li').filterByData('name', user.UserName)
if (existent.length > 0) existent.remove()
var cxids = []
$.each(user.Connections, function () {
cxids.push(this.ConnectionId)
})
addULI(user.UserName, cxids)
})
}
)
}
function onCx () {
setTimeout(function () {
getUsers()
}, 120),
$('#chatview').removeClass('disabled')
$('#sendmessage').prop('disabled',false);
$('#sendpv').prop('disabled',false);
}
function onDisCx () {
$('#chatview').addClass('disabled');
$('#sendmessage').prop('disabled',true);
$('#sendpv').prop('disabled',true);
}
// This optional function html-encodes messages for display in the page.
function htmlEncode (value) {
var encodedValue = $('<div />').text(value).html()
return encodedValue
}
var setPrivate = function (li) {
$('#sendmessagebox').addClass('hidden')
$('#sendpvbox').removeClass('hidden')
pvuis = { CXs: $(li).data('cxids'), UserName: $(li).data('name') }
$('#sendpvdest').html(pvuis.UserName)
$('#pv').focus()
}
var setPublic = function () {
$('#sendmessagebox').removeClass('hidden')
$('#sendpvbox').addClass('hidden')
$('#message').focus()
}
$('#pubChan').css('cursor', 'pointer')
$('#pubChan').click(setPublic)
setPublic()
// Reference the auto-generated proxy for the hub.
var chat = $.connection.chatHub
// Create a function that the hub can call back to display messages.
chat.client.addMessage = function (name, message) {
// Add the message to the page.
$('#discussion').append('<li class="discussion"><strong>' + htmlEncode(name)
+ '</strong>: ' + htmlEncode(message) + '</li>')
}
chat.client.addPV = function (name, message) {
if (!$('#mute').prop('checked')) {
audio.play()
}
// Add the pv to the page.
$('#discussion').append('<li class="pv"><strong>' + htmlEncode(name)
+ '</strong>: ' + htmlEncode(message) + '</li>')
}
$.fn.filterByData = function (prop, val) {
return this.filter(
function () { return $(this).data(prop) == val; }
)
}
var onUserDisconnected = function (cxid) {
$('#userlist li').filter(function () {
var nids = $(this).data('cxids').filter(function () {
return $(this) !== cxid
})
if (nids.Length == 0) $(this).remove()
else $(this).data('cxids', nids)
})
}
var onUserConnected = function (cxid, username) {
var connected = $('#userlist li').filterByData('name', username)
if (connected.length > 0) {
var ids = connected.data('cxids')
ids.push(cxid)
connected.data('cxids', ids)
} else {
addULI(username, [cxid])
}
}
chat.client.notify = function (tag, message, data) {
if (data) {
// Add the pv to the page.
if (tag === 'connected') {
onUserConnected(message, data)
$('#discussion').append('<li class="notif"><i>' + htmlEncode(tag)
+ '</i> ' + htmlEncode(data) + '</li>')
}
else if (tag === 'disconnected') {
onUserDisconnected(message, data)
$('#discussion').append('<li class="notif"><i>' + htmlEncode(tag)
+ '</i> ' + htmlEncode(data) + '</li>')
}else {
$('#discussion').append('<li class="notif"><i>' + htmlEncode(tag)
+ '</i> ' + htmlEncode(message) + ' : ' + htmlEncode(data) + '</li>')
}
}
}
var sendMessage = function () {
chat.server.send($('#displayname').val(), $('#message').val())
// Clear text box and reset focus for next comment.
$('#message').val('')
}
var sendPV = function () {
var msg = $('#pv').val()
// Call the Send method on the hub.
$.each(pvuis.CXs, function () {
chat.server.sendPV(this, msg)
})
$('#discussion').append('<li class="pv">' + htmlEncode(pvuis.UserName)
+ '<< ' + htmlEncode(msg) + '</li>')
// Clear text box and reset focus for next comment.
$('#pv').val('')
}
// Start the connection.
$.connection.hub.start().done(function () {
onCx()
$('#sendmessage').click(function () {
// Call the Send method on the hub.
sendMessage()
$('#message').focus()
})
$('#message').keydown(function (event) {
if (event.which == 13) {
sendMessage()
}
})
$('#pv').keydown(function (event) {
if (event.which == 13) {
sendPV()
}
})
$('#sendpv').click(function () {
// Call the Send method on the hub.
sendPV()
$('#sendpv').focus()
})
})
$.connection.hub.disconnected(function () {
onDisCx()
setTimeout(function () {
$.connection.hub.start().done(function () {
$('#mySignalRConnectionIdHidden').val($.connection.hub.id)
onCx()
}, 30000); // Re-start connection after 30 seconds
})
})
$(window).unload(function () { chat.server.abort(); })
})(jQuery);

1
src/Yavsc/wwwroot/js/chat.min.js vendored Normal file
View File

@ -0,0 +1 @@
!function(t){var s,e=new Audio("/sounds/bell.mp3");function a(n,s){t('<li class="user"><button><img src="/Avatars/'+n+'.xs.png"> '+n+"</button></li>").data("name",n).data("cxids",s).css("cursor","pointer").click(function(){i(this)}).appendTo("#userlist")}function n(){setTimeout(function(){t("#userlist").empty(),t("#to").empty(),t.get("/api/chat/users").done(function(n){t.each(n,function(){var n=this,s=t("#userlist li").filterByData("name",n.UserName);0<s.length&&s.remove();var e=[];t.each(n.Connections,function(){e.push(this.ConnectionId)}),a(n.UserName,e)})})},120),t("#chatview").removeClass("disabled"),t("#sendmessage").prop("disabled",!1),t("#sendpv").prop("disabled",!1)}function o(n){return t("<div />").text(n).html()}var i=function(n){t("#sendmessagebox").addClass("hidden"),t("#sendpvbox").removeClass("hidden"),s={CXs:t(n).data("cxids"),UserName:t(n).data("name")},t("#sendpvdest").html(s.UserName),t("#pv").focus()},c=function(){t("#sendmessagebox").removeClass("hidden"),t("#sendpvbox").addClass("hidden"),t("#message").focus()};t("#pubChan").css("cursor","pointer"),t("#pubChan").click(c),c();var d=t.connection.chatHub;d.client.addMessage=function(n,s){t("#discussion").append('<li class="discussion"><strong>'+o(n)+"</strong>: "+o(s)+"</li>")},d.client.addPV=function(n,s){t("#mute").prop("checked")||e.play(),t("#discussion").append('<li class="pv"><strong>'+o(n)+"</strong>: "+o(s)+"</li>")},t.fn.filterByData=function(n,s){return this.filter(function(){return t(this).data(n)==s})};d.client.notify=function(n,s,e){var i;e&&("connected"===n?(!function(n,s){var e=t("#userlist li").filterByData("name",s);if(0<e.length){var i=e.data("cxids");i.push(n),e.data("cxids",i)}else a(s,[n])}(s,e),t("#discussion").append('<li class="notif"><i>'+o(n)+"</i> "+o(e)+"</li>")):"disconnected"===n?(i=s,t("#userlist li").filter(function(){var n=t(this).data("cxids").filter(function(){return t(this)!==i});0==n.Length?t(this).remove():t(this).data("cxids",n)}),t("#discussion").append('<li class="notif"><i>'+o(n)+"</i> "+o(e)+"</li>")):t("#discussion").append('<li class="notif"><i>'+o(n)+"</i> "+o(s)+" : "+o(e)+"</li>"))};var u=function(){d.server.send(t("#displayname").val(),t("#message").val()),t("#message").val("")},l=function(){var n=t("#pv").val();t.each(s.CXs,function(){d.server.sendPV(this,n)}),t("#discussion").append('<li class="pv">'+o(s.UserName)+"<< "+o(n)+"</li>"),t("#pv").val("")};t.connection.hub.start().done(function(){n(),t("#sendmessage").click(function(){u(),t("#message").focus()}),t("#message").keydown(function(n){13==n.which&&u()}),t("#pv").keydown(function(n){13==n.which&&l()}),t("#sendpv").click(function(){l(),t("#sendpv").focus()})}),t.connection.hub.disconnected(function(){t("#chatview").addClass("disabled"),t("#sendmessage").prop("disabled",!0),t("#sendpv").prop("disabled",!0),setTimeout(function(){t.connection.hub.start().done(function(){t("#mySignalRConnectionIdHidden").val(t.connection.hub.id),n()},3e4)})}),t(window).unload(function(){d.server.abort()})}(jQuery);

View File

@ -0,0 +1,161 @@
if (typeof jQuery === 'undefined') {
throw new Error('Bootstrap\'s JavaScript requires jQuery')
}
+
(function($) {
$.widget("psc.blogcomment", {
options: {
apictrlr: null,
authorId: null,
authorName: null,
omob: '#ffe08030',
omof: '#501208',
bgc: '#fff',
fgc: '#000',
lang: 'fr-FR',
allowCoc: true
},
editable: false,
editting: false,
hideBtn: null,
delBtn: null,
cmtInput: null,
cmtBtn: null,
ctlBtn: null,
collapsed: false,
subCmts: null,
_create: function() {
var _this = this;
this.element.addClass("blogcomment");
var date = new Date(this.element.data("date"));
var username = this.element.data("username");
this.editable = this.element.data("allow-edit");
this.element.prepend('<div class="commentmeta"><div class="avatar"><img src="/Avatars/' + username + '.xs.png" class="smalltofhol" />' + username + '</div><div class="cmtdatetime">' +
date.toLocaleDateString(this.options.lang) + ' ' + date.toLocaleTimeString(this.options.lang) + '</div></div>')
this.element.on("mouseenter", this.onMouseEnter);
this.element.on("mouseleave", this.onMouseLeave);
this.ctlBtn = $('<button class="btn glyphicon-collapse-down"></button>').on("click", function(ev) { _this.toggleCollapse(_this, ev) }).appendTo(_this.element);
},
toggleCollapse: function(_this, ev) {
_this.collapsed = !_this.collapsed;
if (_this.collapsed) {
$(_this.ctlBtn).removeClass('glyphicon-collapse-down');
$(_this.ctlBtn).addClass('glyphicon-collapse-up');
} else {
$(_this.ctlBtn).removeClass('glyphicon-collapse-up');
$(_this.ctlBtn).addClass('glyphicon-collapse-down');
}
if (_this.editable) {
_this.toggleEdit(_this, ev)
}
if (_this.options.allowCoc) {
_this.toggleComment(_this, ev)
}
},
toggleEdit: function(_this, ev) {
if (!_this.delBtn) {
_this.delBtn = $("<button class=\"btn btn-warning\">Supprimer</button>");
_this.delBtn.on("click", function(ev) { _this.doDeleteComment(_this, ev) }).appendTo(_this.element);
} else {
_this.delBtn.remove();
_this.delBtn = null;
}
},
toggleComment: function(_this, ev) {
if (!_this.cmtBtn) {
if (!_this.subCmts) {
_this.subCmts = $(_this.element).children('div.subcomments');
if (_this.subCmts.length == 0) {
_this.subCmts = $('<div></div>').addClass('subcomments');
_this.subCmts.appendTo(_this.element);
}
}
_this.cmtInput = $('<input type="text" placeholder="Votre réponse"/>');
_this.cmtInput.appendTo(_this.element);
_this.cmtBtn = $("<button class=\"btn btn-default\">Répondre</button>");
_this.cmtBtn.on("click", function(ev) { _this.doCoC(_this, ev) }).appendTo(_this.element);
} else {
_this.cmtInput.remove();
_this.cmtBtn.remove();
_this.cmtBtn = null;
}
},
onMouseEnter: function() {
$(this).animate({
backgroundColor: $.psc.blogcomment.prototype.options.omob,
color: $.psc.blogcomment.prototype.options.omof
}, 400);
},
onMouseLeave: function() {
$(this).animate({
backgroundColor: $.psc.blogcomment.prototype.options.bgc,
color: $.psc.blogcomment.prototype.options.fgc
}, 400);
},
doDeleteComment: function(_this, ev) {
var cmtid = $(_this.element).data("id");
var cmtapi = _this.options.apictrlr;
$.ajax({
async: true,
cache: false,
type: 'POST',
method: 'DELETE',
error: function(xhr, data) {
$('span.field-validation-valid[data-valmsg-for="Content"]').html(
"Une erreur est survenue : " + xhr.status + "<br/>"
).focus()
},
success: function(data) {
_this.element.remove()
},
url: cmtapi + '/' + cmtid
});
},
doCoC: function(_this, ev) {
var postid = $('#cmtBtn').data('receiverid');
var comment = _this.cmtInput.val();
var cmtid = $(_this.element).data("id");
var data = {
Content: comment,
PostId: postid,
ParentId: cmtid,
AuthorId: _this.options.authorId
};
$.ajax({
async: true,
cache: false,
type: 'POST',
method: 'POST',
contentType: "application/json",
data: JSON.stringify(data),
error: function(xhr, erd) {
console.log('err');
console.log(xhr);
console.log(erd);
$('span.field-validation-valid[data-valmsg-for="Content"]').html(
"Une erreur est survenue : " + xhr.status + "<br/>" +
"<code><pre>" + xhr.responseText + "</pre></code>"
)
},
success: function(data) {
var comment = data.Content;
_this.cmtInput.val('');
$('span.field-validation-valid[data-valmsg-for="Content"]').empty();
var htmlcmt = htmlize(comment);
$('<div data-type="blogcomment" data-id="' + data.Id + '" data-allow-edit="True" data-date="' + data.DateCreated + '" data-username="' + _this.options.authorName + '">' + htmlcmt + '</div>')
.blogcomment().appendTo(_this.subCmts);
},
url: _this.options.apictrlr
});
}
});
$(document).ready(function() {
$("[data-type='blogcomment']").blogcomment();
})
})(jQuery);

1
src/Yavsc/wwwroot/js/comment.min.js vendored Normal file
View File

@ -0,0 +1 @@
if("undefined"==typeof jQuery)throw new Error("Bootstrap's JavaScript requires jQuery");!function(l){l.widget("psc.blogcomment",{options:{apictrlr:null,authorId:null,authorName:null,omob:"#ffe08030",omof:"#501208",bgc:"#fff",fgc:"#000",lang:"fr-FR",allowCoc:!0},editable:!1,editting:!1,hideBtn:null,delBtn:null,cmtInput:null,cmtBtn:null,ctlBtn:null,collapsed:!1,subCmts:null,_create:function(){var e=this;this.element.addClass("blogcomment");var t=new Date(this.element.data("date")),o=this.element.data("username");this.editable=this.element.data("allow-edit"),this.element.prepend('<div class="commentmeta"><div class="avatar"><img src="/Avatars/'+o+'.xs.png" class="smalltofhol" />'+o+'</div><div class="cmtdatetime">'+t.toLocaleDateString(this.options.lang)+" "+t.toLocaleTimeString(this.options.lang)+"</div></div>"),this.element.on("mouseenter",this.onMouseEnter),this.element.on("mouseleave",this.onMouseLeave),this.ctlBtn=l('<button class="btn glyphicon-collapse-down"></button>').on("click",function(t){e.toggleCollapse(e,t)}).appendTo(e.element)},toggleCollapse:function(t,e){t.collapsed=!t.collapsed,t.collapsed?(l(t.ctlBtn).removeClass("glyphicon-collapse-down"),l(t.ctlBtn).addClass("glyphicon-collapse-up")):(l(t.ctlBtn).removeClass("glyphicon-collapse-up"),l(t.ctlBtn).addClass("glyphicon-collapse-down")),t.editable&&t.toggleEdit(t,e),t.options.allowCoc&&t.toggleComment(t,e)},toggleEdit:function(e,t){e.delBtn?(e.delBtn.remove(),e.delBtn=null):(e.delBtn=l('<button class="btn btn-warning">Supprimer</button>'),e.delBtn.on("click",function(t){e.doDeleteComment(e,t)}).appendTo(e.element))},toggleComment:function(e,t){e.cmtBtn?(e.cmtInput.remove(),e.cmtBtn.remove(),e.cmtBtn=null):(e.subCmts||(e.subCmts=l(e.element).children("div.subcomments"),0==e.subCmts.length&&(e.subCmts=l("<div></div>").addClass("subcomments"),e.subCmts.appendTo(e.element))),e.cmtInput=l('<input type="text" placeholder="Votre réponse"/>'),e.cmtInput.appendTo(e.element),e.cmtBtn=l('<button class="btn btn-default">Répondre</button>'),e.cmtBtn.on("click",function(t){e.doCoC(e,t)}).appendTo(e.element))},onMouseEnter:function(){l(this).animate({backgroundColor:l.psc.blogcomment.prototype.options.omob,color:l.psc.blogcomment.prototype.options.omof},400)},onMouseLeave:function(){l(this).animate({backgroundColor:l.psc.blogcomment.prototype.options.bgc,color:l.psc.blogcomment.prototype.options.fgc},400)},doDeleteComment:function(e,t){var o=l(e.element).data("id"),n=e.options.apictrlr;l.ajax({async:!0,cache:!1,type:"POST",method:"DELETE",error:function(t,e){l('span.field-validation-valid[data-valmsg-for="Content"]').html("Une erreur est survenue : "+t.status+"<br/>").focus()},success:function(t){e.element.remove()},url:n+"/"+o})},doCoC:function(n,t){var e=l("#cmtBtn").data("receiverid"),o={Content:n.cmtInput.val(),PostId:e,ParentId:l(n.element).data("id"),AuthorId:n.options.authorId};l.ajax({async:!0,cache:!1,type:"POST",method:"POST",contentType:"application/json",data:JSON.stringify(o),error:function(t,e){console.log("err"),console.log(t),console.log(e),l('span.field-validation-valid[data-valmsg-for="Content"]').html("Une erreur est survenue : "+t.status+"<br/><code><pre>"+t.responseText+"</pre></code>")},success:function(t){var e=t.Content;n.cmtInput.val(""),l('span.field-validation-valid[data-valmsg-for="Content"]').empty();var o=htmlize(e);l('<div data-type="blogcomment" data-id="'+t.Id+'" data-allow-edit="True" data-date="'+t.DateCreated+'" data-username="'+n.options.authorName+'">'+o+"</div>").blogcomment().appendTo(n.subCmts)},url:n.options.apictrlr})}}),l(document).ready(function(){l("[data-type='blogcomment']").blogcomment()})}(jQuery);

File diff suppressed because it is too large Load Diff

1
src/Yavsc/wwwroot/js/dropzone.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,91 @@
if (typeof jQuery === 'undefined') {
throw new Error('Bootstrap\'s JavaScript requires jQuery')
}
+
(function($, maps) {
$.widget("psc.googlegeocode", {
options: {
mapId: 'map',
longId: 'Longitude',
latId: 'Latitude',
addrValidationId: 'AddressError',
formValidId: 'ValidationSummary',
locComboId: 'LocationCombo'
},
marker: null,
gmap: null,
_create: function() {
this.element.addClass("googlegeocode");
this.gmap = new maps.Map(document.getElementById(this.options.mapId), {
zoom: 16,
center: { lat: 48.862854, lng: 2.2056466 }
});
var _this = this;
this.element.rules("add", {
remote: {
url: 'https://maps.googleapis.com/maps/api/geocode/json',
type: 'get',
data: {
sensor: false,
address: function() {  return _this.element.val() }
},
dataType: 'json',
dataFilter: function(datastr) {
$('#' + _this.options.locComboId).html("");
var data = JSON.parse(datastr);
data.results.forEach(function(item) {
if (item.formatted_address !== _this.element.val()) {
$('<li>' + item.formatted_address + '</li>')
.data("geoloc", item)
.click(function() { _this.chooseLoc('user', item) })
.css('cursor', 'pointer')
.appendTo($('#' + _this.options.locComboId));
} else {}
});
if ((data.status === 'OK') && (data.results.length == 1)) {
// _this.chooseLoc('google',data.results[0]);
return true;
}
return false;
},
error: function() {
// xhr, textStatus, errorThrown console.log('ajax loading error ... '+textStatus+' ... '+ errorThrown);
return false;
}
}
})
},
chooseLoc: function(sender, loc) {
if (sender === 'user') this.element.val(loc.formatted_address);
var pos = loc.geometry.location;
var lat = new Number(pos.lat);
var lng = new Number(pos.lng);
$(document.getElementById(this.options.latId)).val(lat.toLocaleString('en'));
$(document.getElementById(this.options.longId)).val(lng.toLocaleString('en'));
this.gmap.setCenter(pos);
if (this.marker) { 
this.marker.setMap(null);
}
this.marker = new maps.Marker({
map: this.gmap,
draggable: true,
animation: maps.Animation.DROP,
position: pos
});
maps.event.addListener(this.marker, 'dragend', function() {
// TODO reverse geo code
var pos = this.marker.getPosition();
$('#' + this.options.latId).val(pos.lat);
$('#' + this.options.longId).val(pos.lng);
});
this.element.valid();
$('#' + this.options.addrValidationId).empty();
$('#' + this.options.formValidId).empty();
$('#' + this.options.locComboId).empty();
return this;
}
})
})(jQuery, google.maps);

View File

@ -0,0 +1 @@
if("undefined"==typeof jQuery)throw new Error("Bootstrap's JavaScript requires jQuery");!function(r,i){r.widget("psc.googlegeocode",{options:{mapId:"map",longId:"Longitude",latId:"Latitude",addrValidationId:"AddressError",formValidId:"ValidationSummary",locComboId:"LocationCombo"},marker:null,gmap:null,_create:function(){this.element.addClass("googlegeocode"),this.gmap=new i.Map(document.getElementById(this.options.mapId),{zoom:16,center:{lat:48.862854,lng:2.2056466}});var o=this;this.element.rules("add",{remote:{url:"https://maps.googleapis.com/maps/api/geocode/json",type:"get",data:{sensor:!1,address:function(){return o.element.val()}},dataType:"json",dataFilter:function(t){r("#"+o.options.locComboId).html("");var e=JSON.parse(t);return e.results.forEach(function(t){t.formatted_address!==o.element.val()&&r("<li>"+t.formatted_address+"</li>").data("geoloc",t).click(function(){o.chooseLoc("user",t)}).css("cursor","pointer").appendTo(r("#"+o.options.locComboId))}),"OK"===e.status&&1==e.results.length},error:function(){return!1}}})},chooseLoc:function(t,e){"user"===t&&this.element.val(e.formatted_address);var o=e.geometry.location,a=new Number(o.lat),n=new Number(o.lng);return r(document.getElementById(this.options.latId)).val(a.toLocaleString("en")),r(document.getElementById(this.options.longId)).val(n.toLocaleString("en")),this.gmap.setCenter(o),this.marker&&this.marker.setMap(null),this.marker=new i.Marker({map:this.gmap,draggable:!0,animation:i.Animation.DROP,position:o}),i.event.addListener(this.marker,"dragend",function(){var t=this.marker.getPosition();r("#"+this.options.latId).val(t.lat),r("#"+this.options.longId).val(t.lng)}),this.element.valid(),r("#"+this.options.addrValidationId).empty(),r("#"+this.options.formValidId).empty(),r("#"+this.options.locComboId).empty(),this}})}(jQuery,google.maps);

View File

@ -0,0 +1,22 @@
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' + data);
},
error: function() {
console.log('Error @' + allow ? 'POSTed' : 'DELETEd');
}
});
e.preventDefault();
}

1
src/Yavsc/wwwroot/js/input-lib.min.js vendored Normal file
View File

@ -0,0 +1 @@
var allowCircleToBlog=function(o){var t=$(this).prop("checked"),e=$(this).data("circle-id"),a={CircleId:e,BlogPostId:$(this).data("target-id")},c="/api/blogacl";t||(c+="/"+e),console.log(a),$.ajax({url:c,type:t?"POST":"DELETE",data:JSON.stringify(a),contentType:"application/json;charset=utf-8",success:function(o){console.log("POSTED")},error:function(){console.log("POSTed")}}),o.preventDefault()};

9814
src/Yavsc/wwwroot/js/jquery-2.2.4.js vendored Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

10253
src/Yavsc/wwwroot/js/jquery-3.2.1.js vendored Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

18706
src/Yavsc/wwwroot/js/jquery-ui.js vendored Normal file

File diff suppressed because it is too large Load Diff

1
src/Yavsc/wwwroot/js/jquery-ui.min.js vendored Normal file

File diff suppressed because one or more lines are too long

9210
src/Yavsc/wwwroot/js/jquery.js vendored Normal file

File diff suppressed because it is too large Load Diff

1
src/Yavsc/wwwroot/js/jquery.min.js vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,22 @@
var markdownize = function(content) {
if (!content) return '';
var html = content.split("\n").map($.trim).filter(function(line) {
return line != "";
}).join("\n");
return toMarkdown(html);
};
var converter = new showdown.Converter();
var htmlize = function(content) {
return converter.makeHtml(content);
};
var updateMD = function(id,content) {
if (!content) return jQuery('#'+id).val('') ;
var markdown = markdownize(content);
if (jQuery('#'+id).val() === markdown) {
return;
}
jQuery('#'+id).val( markdown );
};

View File

@ -0,0 +1 @@
var markdownize=function(r){if(!r)return"";var n=r.split("\n").map($.trim).filter(function(r){return""!=r}).join("\n");return toMarkdown(n)},converter=new showdown.Converter,htmlize=function(r){return converter.makeHtml(r)},updateMD=function(r,n){if(!n)return jQuery("#"+r).val("");var e=markdownize(n);jQuery("#"+r).val()!==e&&jQuery("#"+r).val(e)};

View File

@ -0,0 +1,97 @@
//
// parralax.js
//
// Author:
// Paul Schneider <paul@pschneider.fr>
//
// Copyright (c) 2015 GNU GPL
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
$(document).ready(function($){
var $window = $(window);
var $stwidth = $(window).width();
var $stheight = $(window).height();
var onPos = function (bgobj,ax,ay) {
var speed = bgobj.data('speed');
var dx=($window.scrollLeft()+ax-$stwidth/2)/speed;
var dy=($window.scrollTop()+ay-$stheight/2)/speed;
var xPos = bgobj.attr('orgbgpx') - Math.round( dx );
var yPos = bgobj.attr('orgbgpy') - Math.round( dy );
// Put together our final background position
var coords = '' + xPos + bgobj.attr('orgbgpxu') + yPos + bgobj.attr('orgbgpyu');
// Move the background
bgobj.css({ backgroundPosition: coords });
};
var tiltLR=0;
var titleFB=0;
$('[data-type="background"]').each(function(){
var $bgobj = $(this); // assigning the object
// get the initial background position, assumes a "X% Yem" ?
var orgpos = $bgobj.css('backgroundPosition');
var bgpos = orgpos.split(" ");
var bgposx = bgpos[0];
var bgposy = bgpos[1];
if (/%$/.test(bgposx)){
bgposx = bgposx.substr(0,bgposx.length-1);
$bgobj.attr('orgbgpxu','% ');
}
else if (/em$/.test(bgposx)){
bgposx = bgposx.substr(0,bgposx.length-2);
$bgobj.attr('orgbgpxu','em ');
}
else if (/px$/.test(bgposx)){
bgposx = bgposx.substr(0,bgposx.length-2);
$bgobj.attr('orgbgpxu','px ');
}
else { $bgobj.attr('orgbgpxu','px '); }
if (/%$/.test(bgposy)){
bgposy = bgposy.substr(0,bgposy.length-1);
$bgobj.attr('orgbgpyu','% ');
}
else if (/em$/.test(bgposy)){
bgposy = bgposy.substr(0,bgposy.length-2);
$bgobj.attr('orgbgpyu','em ');
}
else if (/px$/.test(bgposy)){
bgposy = bgposy.substr(0,bgposy.length-2);
$bgobj.attr('orgbgpyu','px ');
}
else { $bgobj.attr('orgbgpyu','px '); }
$bgobj.attr('orgbgpx',parseInt(bgposx));
$bgobj.attr('orgbgpy',parseInt(bgposy));
$(window).scroll(function() {
onPos($bgobj,tiltLR,titleFB);
});
if (window.DeviceOrientationEvent) {
if ($stwidth>320 && $stheight>320) {
window.addEventListener('deviceorientation', function(event) {
tiltLR = $stwidth*Math.sin(event.gamma*Math.PI/180);
titleFB = $stheight*Math.sin(event.beta*Math.PI/90);
onPos($bgobj,tiltLR,titleFB);
},false); }
$(window).mousemove(function(e) {
tiltLR = e.pageX;
titleFB = e.pageY;
onPos($bgobj,e.pageX,e.pageY);
});
}
});
}(jQuery));

1
src/Yavsc/wwwroot/js/parallax.min.js vendored Normal file
View File

@ -0,0 +1 @@
$(document).ready(function(o){var u=o(window),p=o(window).width(),b=o(window).height(),a=function(t,r,e){var n=t.data("speed"),o=(u.scrollLeft()+r-p/2)/n,a=(u.scrollTop()+e-b/2)/n,g=t.attr("orgbgpx")-Math.round(o),s=t.attr("orgbgpy")-Math.round(a),i=""+g+t.attr("orgbgpxu")+s+t.attr("orgbgpyu");t.css({backgroundPosition:i})},g=0,s=0;o('[data-type="background"]').each(function(){var r=o(this),t=r.css("backgroundPosition").split(" "),e=t[0],n=t[1];/%$/.test(e)?(e=e.substr(0,e.length-1),r.attr("orgbgpxu","% ")):/em$/.test(e)?(e=e.substr(0,e.length-2),r.attr("orgbgpxu","em ")):(/px$/.test(e)&&(e=e.substr(0,e.length-2)),r.attr("orgbgpxu","px ")),/%$/.test(n)?(n=n.substr(0,n.length-1),r.attr("orgbgpyu","% ")):/em$/.test(n)?(n=n.substr(0,n.length-2),r.attr("orgbgpyu","em ")):(/px$/.test(n)&&(n=n.substr(0,n.length-2)),r.attr("orgbgpyu","px ")),r.attr("orgbgpx",parseInt(e)),r.attr("orgbgpy",parseInt(n)),o(window).scroll(function(){a(r,g,s)}),window.DeviceOrientationEvent&&(320<p&&320<b&&window.addEventListener("deviceorientation",function(t){g=p*Math.sin(t.gamma*Math.PI/180),s=b*Math.sin(t.beta*Math.PI/90),a(r,g,s)},!1),o(window).mousemove(function(t){g=t.pageX,s=t.pageY,a(r,t.pageX,t.pageY)}))})}(jQuery));

View File

@ -0,0 +1,33 @@
+(function($, paypal, PAYPAL_ENV, CREATE_PAYMENT_URL, EXECUTE_PAYMENT_URL) {
$(document).ready(function() {
paypal.Button.render({
env: PAYPAL_ENV, // 'production', Optional: specify 'sandbox' environment
commit: true,
payment: function(resolve, reject) {
return paypal.request.post(CREATE_PAYMENT_URL)
.then(function(data) { resolve(data.id); })
.catch(function(err) { reject(err); });
},
onAuthorize: function(data) {
// Note: you can display a confirmation page before executing
return paypal.request.post(EXECUTE_PAYMENT_URL, { paymentID: data.paymentID, payerID: data.payerID })
.then(function(data) {
document.location = '@ViewBag.Urls.Details';
/* Go to a success page */
})
.catch(function(err) {
document.location = '/Manage/PaymentInfo/' + data.paymentID + '/?error=' + err;
/* Go to an error page */
});
}
}, '#paypal-button');
})
})(jQuery);

View File

@ -0,0 +1 @@
!function(n,o,t,e,u){jQuery(document).ready(function(){o.Button.render({env:void 0,commit:!0,payment:function(t,e){return o.request.post(void 0).then(function(n){t(n.id)}).catch(function(n){e(n)})},onAuthorize:function(t){return o.request.post(void 0,{paymentID:t.paymentID,payerID:t.payerID}).then(function(n){document.location="@ViewBag.Urls.Details"}).catch(function(n){document.location="/Manage/PaymentInfo/"+t.paymentID+"/?error="+n})}},"#paypal-button")})}();

10749
src/Yavsc/wwwroot/js/quill.js Normal file

File diff suppressed because it is too large Load Diff

1
src/Yavsc/wwwroot/js/quill.min.js vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

1
src/Yavsc/wwwroot/js/showdown.min.js vendored Normal file

File diff suppressed because one or more lines are too long

11
src/Yavsc/wwwroot/js/site.js Executable file
View File

@ -0,0 +1,11 @@
var notifClick =
function(nid) {
if (nid > 0) {
$.get('/api/dimiss/click/' + nid);
}
};
var setUiCult = function(lngspec) {
document.cookie = 'ASPNET_CULTURE=c=' + lngspec + '|uic=' + lngspec;
location.reload();
};

1
src/Yavsc/wwwroot/js/site.min.js vendored Executable file
View File

@ -0,0 +1 @@
var notifClick=function(i){0<i&&$.get("/api/dimiss/click/"+i)},setUiCult=function(i){document.cookie="ASPNET_CULTURE=c="+i+"|uic="+i,location.reload()};

View File

@ -0,0 +1,12 @@
var constraints = { audio: true, video: false }
navigator.mediaDevices.getUserMedia(constraints)
.then(function(stream) {
/* use the stream */
console.log("got stream!");
console.log(stream)
})
.catch(function(err) {
/* handle the error */
console.log(err)
});

1
src/Yavsc/wwwroot/js/str.min.js vendored Normal file
View File

@ -0,0 +1 @@
var constraints={audio:!0,video:!1};navigator.mediaDevices.getUserMedia(constraints).then(function(o){console.log("got stream!"),console.log(o)}).catch(function(o){console.log(o)});

View File

@ -0,0 +1,842 @@
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.toMarkdown = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
/*
* to-markdown - an HTML to Markdown converter
*
* Copyright 2011+, Dom Christie
* Licenced under the MIT licence
*
*/
'use strict'
var toMarkdown
var converters
var mdConverters = require('./lib/md-converters')
var gfmConverters = require('./lib/gfm-converters')
var HtmlParser = require('./lib/html-parser')
var collapse = require('collapse-whitespace')
/*
* Utilities
*/
var blocks = ['address', 'article', 'aside', 'audio', 'blockquote', 'body',
'canvas', 'center', 'dd', 'dir', 'div', 'dl', 'dt', 'fieldset', 'figcaption',
'figure', 'footer', 'form', 'frameset', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6',
'header', 'hgroup', 'hr', 'html', 'isindex', 'li', 'main', 'menu', 'nav',
'noframes', 'noscript', 'ol', 'output', 'p', 'pre', 'section', 'table',
'tbody', 'td', 'tfoot', 'th', 'thead', 'tr', 'ul'
]
function isBlock (node) {
return blocks.indexOf(node.nodeName.toLowerCase()) !== -1
}
var voids = [
'area', 'base', 'br', 'col', 'command', 'embed', 'hr', 'img', 'input',
'keygen', 'link', 'meta', 'param', 'source', 'track', 'wbr'
]
function isVoid (node) {
return voids.indexOf(node.nodeName.toLowerCase()) !== -1
}
function htmlToDom (string) {
var tree = new HtmlParser().parseFromString(string, 'text/html')
collapse(tree.documentElement, isBlock)
return tree
}
/*
* Flattens DOM tree into single array
*/
function bfsOrder (node) {
var inqueue = [node]
var outqueue = []
var elem
var children
var i
while (inqueue.length > 0) {
elem = inqueue.shift()
outqueue.push(elem)
children = elem.childNodes
for (i = 0; i < children.length; i++) {
if (children[i].nodeType === 1) inqueue.push(children[i])
}
}
outqueue.shift()
return outqueue
}
/*
* Contructs a Markdown string of replacement text for a given node
*/
function getContent (node) {
var text = ''
for (var i = 0; i < node.childNodes.length; i++) {
if (node.childNodes[i].nodeType === 1) {
text += node.childNodes[i]._replacement
} else if (node.childNodes[i].nodeType === 3) {
text += node.childNodes[i].data
} else continue
}
return text
}
/*
* Returns the HTML string of an element with its contents converted
*/
function outer (node, content) {
return node.cloneNode(false).outerHTML.replace('><', '>' + content + '<')
}
function canConvert (node, filter) {
if (typeof filter === 'string') {
return filter === node.nodeName.toLowerCase()
}
if (Array.isArray(filter)) {
return filter.indexOf(node.nodeName.toLowerCase()) !== -1
} else if (typeof filter === 'function') {
return filter.call(toMarkdown, node)
} else {
throw new TypeError('`filter` needs to be a string, array, or function')
}
}
function isFlankedByWhitespace (side, node) {
var sibling
var regExp
var isFlanked
if (side === 'left') {
sibling = node.previousSibling
regExp = / $/
} else {
sibling = node.nextSibling
regExp = /^ /
}
if (sibling) {
if (sibling.nodeType === 3) {
isFlanked = regExp.test(sibling.nodeValue)
} else if (sibling.nodeType === 1 && !isBlock(sibling)) {
isFlanked = regExp.test(sibling.textContent)
}
}
return isFlanked
}
function flankingWhitespace (node, content) {
var leading = ''
var trailing = ''
if (!isBlock(node)) {
var hasLeading = /^[ \r\n\t]/.test(content)
var hasTrailing = /[ \r\n\t]$/.test(content)
if (hasLeading && !isFlankedByWhitespace('left', node)) {
leading = ' '
}
if (hasTrailing && !isFlankedByWhitespace('right', node)) {
trailing = ' '
}
}
return { leading: leading, trailing: trailing }
}
/*
* Finds a Markdown converter, gets the replacement, and sets it on
* `_replacement`
*/
function process (node) {
var replacement
var content = getContent(node)
// Remove blank nodes
if (!isVoid(node) && !/A|TH|TD/.test(node.nodeName) && /^\s*$/i.test(content)) {
node._replacement = ''
return
}
for (var i = 0; i < converters.length; i++) {
var converter = converters[i]
if (canConvert(node, converter.filter)) {
if (typeof converter.replacement !== 'function') {
throw new TypeError(
'`replacement` needs to be a function that returns a string'
)
}
var whitespace = flankingWhitespace(node, content)
if (whitespace.leading || whitespace.trailing) {
content = content.trim()
}
replacement = whitespace.leading +
converter.replacement.call(toMarkdown, content, node) +
whitespace.trailing
break
}
}
node._replacement = replacement
}
toMarkdown = function (input, options) {
options = options || {}
if (typeof input !== 'string') {
throw new TypeError(input + ' is not a string')
}
if (input === '') {
return ''
}
// Escape potential ol triggers
input = input.replace(/(\d+)\. /g, '$1\\. ')
var clone = htmlToDom(input).body
var nodes = bfsOrder(clone)
var output
converters = mdConverters.slice(0)
if (options.gfm) {
converters = gfmConverters.concat(converters)
}
if (options.converters) {
converters = options.converters.concat(converters)
}
// Process through nodes in reverse (so deepest child elements are first).
for (var i = nodes.length - 1; i >= 0; i--) {
process(nodes[i])
}
output = getContent(clone)
return output.replace(/^[\t\r\n]+|[\t\r\n\s]+$/g, '')
.replace(/\n\s+\n/g, '\n\n')
.replace(/\n{3,}/g, '\n\n')
}
toMarkdown.isBlock = isBlock
toMarkdown.isVoid = isVoid
toMarkdown.outer = outer
module.exports = toMarkdown
},{"./lib/gfm-converters":2,"./lib/html-parser":3,"./lib/md-converters":4,"collapse-whitespace":7}],2:[function(require,module,exports){
'use strict'
function cell (content, node) {
var index = Array.prototype.indexOf.call(node.parentNode.childNodes, node)
var prefix = ' '
if (index === 0) prefix = '| '
return prefix + content + ' |'
}
var highlightRegEx = /highlight highlight-(\S+)/
module.exports = [
{
filter: 'br',
replacement: function () {
return '\n'
}
},
{
filter: ['del', 's', 'strike'],
replacement: function (content) {
return '~~' + content + '~~'
}
},
{
filter: function (node) {
return node.type === 'checkbox' && node.parentNode.nodeName === 'LI'
},
replacement: function (content, node) {
return (node.checked ? '[x]' : '[ ]') + ' '
}
},
{
filter: ['th', 'td'],
replacement: function (content, node) {
return cell(content, node)
}
},
{
filter: 'tr',
replacement: function (content, node) {
var borderCells = ''
var alignMap = { left: ':--', right: '--:', center: ':-:' }
if (node.parentNode.nodeName === 'THEAD') {
for (var i = 0; i < node.childNodes.length; i++) {
var align = node.childNodes[i].attributes.align
var border = '---'
if (align) border = alignMap[align.value] || border
borderCells += cell(border, node.childNodes[i])
}
}
return '\n' + content + (borderCells ? '\n' + borderCells : '')
}
},
{
filter: 'table',
replacement: function (content) {
return '\n\n' + content + '\n\n'
}
},
{
filter: ['thead', 'tbody', 'tfoot'],
replacement: function (content) {
return content
}
},
// Fenced code blocks
{
filter: function (node) {
return node.nodeName === 'PRE' &&
node.firstChild &&
node.firstChild.nodeName === 'CODE'
},
replacement: function (content, node) {
return '\n\n```\n' + node.firstChild.textContent + '\n```\n\n'
}
},
// Syntax-highlighted code blocks
{
filter: function (node) {
return node.nodeName === 'PRE' &&
node.parentNode.nodeName === 'DIV' &&
highlightRegEx.test(node.parentNode.className)
},
replacement: function (content, node) {
var language = node.parentNode.className.match(highlightRegEx)[1]
return '\n\n```' + language + '\n' + node.textContent + '\n```\n\n'
}
},
{
filter: function (node) {
return node.nodeName === 'DIV' &&
highlightRegEx.test(node.className)
},
replacement: function (content) {
return '\n\n' + content + '\n\n'
}
}
]
},{}],3:[function(require,module,exports){
/*
* Set up window for Node.js
*/
var _window = (typeof window !== 'undefined' ? window : this)
/*
* Parsing HTML strings
*/
function canParseHtmlNatively () {
var Parser = _window.DOMParser
var canParse = false
// Adapted from https://gist.github.com/1129031
// Firefox/Opera/IE throw errors on unsupported types
try {
// WebKit returns null on unsupported types
if (new Parser().parseFromString('', 'text/html')) {
canParse = true
}
} catch (e) {}
return canParse
}
function createHtmlParser () {
var Parser = function () {}
// For Node.js environments
if (typeof document === 'undefined') {
var jsdom = require('jsdom')
Parser.prototype.parseFromString = function (string) {
return jsdom.jsdom(string, {
features: {
FetchExternalResources: [],
ProcessExternalResources: false
}
})
}
} else {
if (!shouldUseActiveX()) {
Parser.prototype.parseFromString = function (string) {
var doc = document.implementation.createHTMLDocument('')
doc.open()
doc.write(string)
doc.close()
return doc
}
} else {
Parser.prototype.parseFromString = function (string) {
var doc = new window.ActiveXObject('htmlfile')
doc.designMode = 'on' // disable on-page scripts
doc.open()
doc.write(string)
doc.close()
return doc
}
}
}
return Parser
}
function shouldUseActiveX () {
var useActiveX = false
try {
document.implementation.createHTMLDocument('').open()
} catch (e) {
if (window.ActiveXObject) useActiveX = true
}
return useActiveX
}
module.exports = canParseHtmlNatively() ? _window.DOMParser : createHtmlParser()
},{"jsdom":6}],4:[function(require,module,exports){
'use strict'
module.exports = [
{
filter: 'p',
replacement: function (content) {
return '\n\n' + content + '\n\n'
}
},
{
filter: 'br',
replacement: function () {
return ' \n'
}
},
{
filter: ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'],
replacement: function (content, node) {
var hLevel = node.nodeName.charAt(1)
var hPrefix = ''
for (var i = 0; i < hLevel; i++) {
hPrefix += '#'
}
return '\n\n' + hPrefix + ' ' + content + '\n\n'
}
},
{
filter: 'hr',
replacement: function () {
return '\n\n* * *\n\n'
}
},
{
filter: ['em', 'i'],
replacement: function (content) {
return '_' + content + '_'
}
},
{
filter: ['strong', 'b'],
replacement: function (content) {
return '**' + content + '**'
}
},
{
filter: ['u'],
replacement: function (content) {
return '_' + content + '_'
}
},
{
filter: ['del', 's', 'strike'],
replacement: function (content) {
return '~~' + content + '~~'
}
},
{
filter: 'div',
replacement: function (content) {
return content + '\n\n'
}
},
// Inline code
{
filter: function (node) {
var hasSiblings = node.previousSibling || node.nextSibling
var isCodeBlock = node.parentNode.nodeName === 'PRE' && !hasSiblings
return node.nodeName === 'CODE' && !isCodeBlock
},
replacement: function (content) {
return '`' + content + '`'
}
},
{
filter: function (node) {
return node.nodeName === 'A' && node.getAttribute('href')
},
replacement: function (content, node) {
var titlePart = node.title ? ' "' + node.title + '"' : ''
return '[' + content + '](' + node.getAttribute('href') + titlePart + ')'
}
},
{
filter: 'video',
replacement: function (content, node) {
var alt = node.getAttribute('alt') || ''
var src
for (var i = 0; i < node.childNodes.length; i++) {
if (node.childNodes[i].localName === 'source') {
src = node.childNodes[i].getAttribute('src')
break
} }
var title = node.title || ''
var titlePart = title ? ' "' + title + '"' : ''
return src ? '![video:' + alt + ']' + '(' + src + titlePart + ')' : ''
}
},
{
filter: 'audio',
replacement: function (content, node) {
var alt = node.getAttribute('alt') || ''
var src = node.getAttribute('src') || ''
if (!src) {
for (var i = 0; i < node.childNodes.length; i++) {
if (node.childNodes[i].localName === 'source') {
src = node.childNodes[i].getAttribute('src')
break
} } }
var title = node.title || ''
var titlePart = title ? ' "' + title + '"' : ''
return src ? '![audio:' + alt + ']' + '(' + src + titlePart + ')' : ''
}
},
{
filter: 'img',
replacement: function (content, node) {
var alt = node.alt || ''
var src = node.getAttribute('src') || ''
var title = node.title || ''
var titlePart = title ? ' "' + title + '"' : ''
return src ? '![' + alt + ']' + '(' + src + titlePart + ')' : ''
}
},
// Code blocks
{
filter: function (node) {
return node.nodeName === 'PRE' && node.firstChild.nodeName === 'CODE'
},
replacement: function (content, node) {
return '\n\n ' + node.firstChild.textContent.replace(/\n/g, '\n ') + '\n\n'
}
},
{
filter: 'blockquote',
replacement: function (content) {
content = content.trim()
content = content.replace(/\n{3,}/g, '\n\n')
content = content.replace(/^/gm, '> ')
return '\n\n' + content + '\n\n'
}
},
{
filter: 'li',
replacement: function (content, node) {
content = content.replace(/^\s+/, '').replace(/\n/gm, '\n ')
var prefix = '* '
var parent = node.parentNode
var index = Array.prototype.indexOf.call(parent.children, node) + 1
prefix = /ol/i.test(parent.nodeName) ? index + '. ' : '* '
return prefix + content
}
},
{
filter: ['ul', 'ol'],
replacement: function (content, node) {
var strings = []
for (var i = 0; i < node.childNodes.length; i++) {
strings.push(node.childNodes[i]._replacement)
}
if (/li/i.test(node.parentNode.nodeName)) {
return '\n' + strings.join('\n')
}
return '\n\n' + strings.join('\n') + '\n\n'
}
},
{
filter: function (node) {
return this.isBlock(node)
},
replacement: function (content, node) {
return '\n\n' + this.outer(node, content) + '\n\n'
}
},
// Anything else!
{
filter: function () {
return true
},
replacement: function (content, node) {
return this.outer(node, content)
}
}
]
},{}],5:[function(require,module,exports){
/**
* This file automatically generated from `build.js`.
* Do not manually edit.
*/
module.exports = [
"address",
"article",
"aside",
"audio",
"blockquote",
"canvas",
"dd",
"div",
"dl",
"fieldset",
"figcaption",
"figure",
"footer",
"form",
"h1",
"h2",
"h3",
"h4",
"h5",
"h6",
"header",
"hgroup",
"hr",
"main",
"nav",
"noscript",
"ol",
"output",
"p",
"pre",
"section",
"table",
"tfoot",
"ul",
"video"
];
},{}],6:[function(require,module,exports){
},{}],7:[function(require,module,exports){
'use strict';
var voidElements = require('void-elements');
Object.keys(voidElements).forEach(function (name) {
voidElements[name.toUpperCase()] = 1;
});
var blockElements = {};
require('block-elements').forEach(function (name) {
blockElements[name.toUpperCase()] = 1;
});
/**
* isBlockElem(node) determines if the given node is a block element.
*
* @param {Node} node
* @return {Boolean}
*/
function isBlockElem(node) {
return !!(node && blockElements[node.nodeName]);
}
/**
* isVoid(node) determines if the given node is a void element.
*
* @param {Node} node
* @return {Boolean}
*/
function isVoid(node) {
return !!(node && voidElements[node.nodeName]);
}
/**
* whitespace(elem [, isBlock]) removes extraneous whitespace from an
* the given element. The function isBlock may optionally be passed in
* to determine whether or not an element is a block element; if none
* is provided, defaults to using the list of block elements provided
* by the `block-elements` module.
*
* @param {Node} elem
* @param {Function} blockTest
*/
function collapseWhitespace(elem, isBlock) {
if (!elem.firstChild || elem.nodeName === 'PRE') return;
if (typeof isBlock !== 'function') {
isBlock = isBlockElem;
}
var prevText = null;
var prevVoid = false;
var prev = null;
var node = next(prev, elem);
while (node !== elem) {
if (node.nodeType === 3) {
// Node.TEXT_NODE
var text = node.data.replace(/[ \r\n\t]+/g, ' ');
if ((!prevText || / $/.test(prevText.data)) && !prevVoid && text[0] === ' ') {
text = text.substr(1);
}
// `text` might be empty at this point.
if (!text) {
node = remove(node);
continue;
}
node.data = text;
prevText = node;
} else if (node.nodeType === 1) {
// Node.ELEMENT_NODE
if (isBlock(node) || node.nodeName === 'BR') {
if (prevText) {
prevText.data = prevText.data.replace(/ $/, '');
}
prevText = null;
prevVoid = false;
} else if (isVoid(node)) {
// Avoid trimming space around non-block, non-BR void elements.
prevText = null;
prevVoid = true;
}
} else {
node = remove(node);
continue;
}
var nextNode = next(prev, node);
prev = node;
node = nextNode;
}
if (prevText) {
prevText.data = prevText.data.replace(/ $/, '');
if (!prevText.data) {
remove(prevText);
}
}
}
/**
* remove(node) removes the given node from the DOM and returns the
* next node in the sequence.
*
* @param {Node} node
* @return {Node} node
*/
function remove(node) {
var next = node.nextSibling || node.parentNode;
node.parentNode.removeChild(node);
return next;
}
/**
* next(prev, current) returns the next node in the sequence, given the
* current and previous nodes.
*
* @param {Node} prev
* @param {Node} current
* @return {Node}
*/
function next(prev, current) {
if (prev && prev.parentNode === current || current.nodeName === 'PRE') {
return current.nextSibling || current.parentNode;
}
return current.firstChild || current.nextSibling || current.parentNode;
}
module.exports = collapseWhitespace;
},{"block-elements":5,"void-elements":8}],8:[function(require,module,exports){
/**
* This file automatically generated from `pre-publish.js`.
* Do not manually edit.
*/
module.exports = {
"area": true,
"base": true,
"br": true,
"col": true,
"embed": true,
"hr": true,
"img": true,
"input": true,
"keygen": true,
"link": true,
"menuitem": true,
"meta": true,
"param": true,
"source": true,
"track": true,
"wbr": true
};
},{}]},{},[1])(1)
});

File diff suppressed because one or more lines are too long