mirror of
https://github.com/neocities/neocities.git
synced 2025-04-24 17:22:35 +02:00
Merge branch 'master' into validation-checkbox
This commit is contained in:
commit
6c8bad2e42
6 changed files with 70 additions and 9 deletions
|
@ -28,7 +28,7 @@ Now you can access the running site from your browser: http://127.0.0.1:9292
|
|||
|
||||
If you'd like to fix a bug, or make an improvement, or add a new feature, it's easy! Just send us a Pull Request.
|
||||
|
||||
1. Fork it (<http://github.com/YOURUSERNAME/neocities/fork>)
|
||||
1. Fork it (https://github.com/neocities/neocities/fork)
|
||||
2. Create your feature branch (`git checkout -b my-new-feature`)
|
||||
3. Commit your changes (`git commit -am 'Add some feature'`)
|
||||
4. Push to the branch (`git push origin my-new-feature`)
|
||||
|
|
|
@ -47,7 +47,7 @@ class Site < Sequel::Model
|
|||
}
|
||||
|
||||
VALID_EDITABLE_EXTENSIONS = %w{
|
||||
html htm txt js css scss md manifest less webmanifest xml json opml rdf
|
||||
html htm txt js css scss md manifest less webmanifest xml json opml rdf svg
|
||||
}
|
||||
|
||||
MINIMUM_PASSWORD_LENGTH = 5
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
var ProfileComment = {
|
||||
displayEditor: function(eventId) {
|
||||
var commentDiv = $('#event_'+eventId+' div.content')
|
||||
var eventActions = $('#event_'+eventId+'_actions')
|
||||
var commentDiv = $('#event_'+eventId+' div.content').first()
|
||||
var eventActions = $('#event_'+eventId+'_actions').first()
|
||||
|
||||
eventActions.find('a#editLink').css('display', 'none')
|
||||
|
||||
|
@ -10,15 +10,14 @@ var ProfileComment = {
|
|||
},
|
||||
|
||||
cancelEditor: function(eventId) {
|
||||
var eventActions = $('#event_'+eventId+'_actions')
|
||||
var commentDiv = $('#event_'+eventId+' div.content')
|
||||
var eventActions = $('#event_'+eventId+'_actions').first()
|
||||
var commentDiv = $('#event_'+eventId+' div.content').first()
|
||||
eventActions.find('a#editLink').css('display', 'inline')
|
||||
commentDiv.text(commentDiv.find('textarea').text())
|
||||
},
|
||||
|
||||
update: function(eventId, csrfToken) {
|
||||
var eventActions = $('#event_'+eventId+'_actions')
|
||||
var commentDiv = $('#event_'+eventId+' div.content')
|
||||
var commentDiv = $('#event_'+eventId+' div.content').first()
|
||||
var self = this
|
||||
console.log(commentDiv.find('textarea').val())
|
||||
$.post('/event/'+eventId+'/update_profile_comment', {
|
||||
|
|
|
@ -71,6 +71,11 @@
|
|||
<div id="progressBar" class="progress-bar" style="display: none"><div id="uploadingProgress" class="progress" style="width: 0%"></div></div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="movingOverlay" class="uploading-overlay" style="display: none">
|
||||
<div class="uploading">
|
||||
<p>Moving file, please wait...</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="header">
|
||||
<div class="btn-group" role="group" aria-label="...">
|
||||
<button type="button" class="btn btn-default iconview-button" title="Icon View" onclick="iconView()"><i class="fa fa-th"></i></button>
|
||||
|
@ -119,7 +124,7 @@
|
|||
<div class="overlay"></div>
|
||||
</div>
|
||||
<% elsif file[:is_directory] %>
|
||||
<div class="html-thumbnail folder fileimagehover">
|
||||
<div class="html-thumbnail folder fileimagehover" ondrop="moveFileToFolder(event)">
|
||||
<div class="folder-icon"></div>
|
||||
<div class="overlay"></div>
|
||||
</div>
|
||||
|
@ -272,6 +277,55 @@
|
|||
<script src="/js/dropzone.min.js"></script>
|
||||
<script>
|
||||
|
||||
var uploadForm = $('#uploadFilesButtonForm')[0];
|
||||
var deleteForm = $('#deleteFilenameForm')[0];
|
||||
|
||||
function moveFileToFolder(event) {
|
||||
var link = event.dataTransfer.getData("Text");
|
||||
if(link) link = link.trim();
|
||||
if(!link || link.startsWith('https://neocities.org/dashboard')) return;
|
||||
event.preventDefault();
|
||||
var name = link.split('.neocities.org/').slice(1).join('.neocities.org/');
|
||||
var oReq = new XMLHttpRequest();
|
||||
oReq.open("GET", "/site_files/download/" + name, true);
|
||||
oReq.responseType = "arraybuffer";
|
||||
|
||||
$('#movingOverlay').css('display', 'block')
|
||||
|
||||
oReq.onload = function() {
|
||||
var newFile = new File([oReq.response], name);
|
||||
var dataTransfer = new DataTransfer();
|
||||
var currentFolder = new URL(location.href).searchParams.get('dir');
|
||||
if(!currentFolder) currentFolder = '';
|
||||
else currentFolder = currentFolder + '/';
|
||||
|
||||
dataTransfer.items.add(newFile);
|
||||
$('#uploadFilesButtonForm > input[name="dir"]')[0].value = currentFolder + event.target.parentElement.parentElement.getElementsByClassName('title')[0].innerText.trim();
|
||||
$('#uploadFiles')[0].files = dataTransfer.files;
|
||||
$.ajax({
|
||||
type: uploadForm.method,
|
||||
url: uploadForm.action,
|
||||
data: new FormData(uploadForm),
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function() {
|
||||
let csrf = $('#uploadFilesButtonForm > input[name="csrf_token"]')[0].value;
|
||||
var dReq = new XMLHttpRequest();
|
||||
dReq.open(deleteForm.method, deleteForm.action, true);
|
||||
dReq.onload = function() {
|
||||
location.reload()
|
||||
}
|
||||
dReq.setRequestHeader("content-type", 'application/x-www-form-urlencoded');
|
||||
dReq.send("csrf_token=" + encodeURIComponent(csrf) + "&filename=" + name.replace(/\s/g, '+'));
|
||||
},
|
||||
error: function() {
|
||||
location.reload()
|
||||
}
|
||||
});
|
||||
};
|
||||
oReq.send();
|
||||
}
|
||||
|
||||
function confirmFileRename(path) {
|
||||
console.log(path)
|
||||
$('#renamePathInput').val(path);
|
||||
|
|
|
@ -183,6 +183,7 @@
|
|||
editor.setBehavioursEnabled(false)
|
||||
|
||||
editor.setValue(resp, -1)
|
||||
editor.getSession().setUndoManager(new ace.UndoManager())
|
||||
|
||||
editor.on('change', function(obj) {
|
||||
$('a#saveButton,a#saveAndExitButton').css('opacity', 1)
|
||||
|
|
|
@ -69,6 +69,9 @@
|
|||
<li>
|
||||
<a href="https://bulma.io/" title="Bulma: The Framework Built on Flexbox" target="_blank">Bulma</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="https://chrisnager.github.io/ungrid/" title="ungrid: the simplest responsive css grid">ungird</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>JavaScript</h3>
|
||||
|
@ -95,6 +98,10 @@
|
|||
</li>
|
||||
<li>
|
||||
<a href="https://www.gatsbyjs.org/">Gatsby</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="https://v2.vuepress.vuejs.org/">VuePress</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>WebGL</h3>
|
||||
|
|
Loading…
Add table
Reference in a new issue