mirror of
https://github.com/neocities/neocities.git
synced 2025-04-24 17:22:35 +02:00
chat: minor visual tweaks
This commit is contained in:
commit
2b2954b0fd
7 changed files with 64 additions and 27 deletions
15
migrations/125_sites_stats_bigint.rb
Normal file
15
migrations/125_sites_stats_bigint.rb
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
Sequel.migration do
|
||||||
|
up {
|
||||||
|
alter_table(:sites) do
|
||||||
|
set_column_type :hits, :bigint
|
||||||
|
set_column_type :views, :bigint
|
||||||
|
end
|
||||||
|
}
|
||||||
|
|
||||||
|
down {
|
||||||
|
alter_table(:sites) do
|
||||||
|
set_column_type :hits, Integer
|
||||||
|
set_column_type :views, Integer
|
||||||
|
end
|
||||||
|
}
|
||||||
|
end
|
|
@ -8,10 +8,9 @@ class Site < Sequel::Model
|
||||||
include Sequel::ParanoidDelete
|
include Sequel::ParanoidDelete
|
||||||
|
|
||||||
VALID_MIME_TYPES = %w{
|
VALID_MIME_TYPES = %w{
|
||||||
|
application/atom+xml
|
||||||
application/epub
|
application/epub
|
||||||
application/epub+zip
|
application/epub+zip
|
||||||
application/font-sfnt
|
|
||||||
application/javascript
|
|
||||||
application/json
|
application/json
|
||||||
application/octet-stream
|
application/octet-stream
|
||||||
application/opensearchdescription+xml
|
application/opensearchdescription+xml
|
||||||
|
@ -21,10 +20,13 @@ class Site < Sequel::Model
|
||||||
application/rss+xml
|
application/rss+xml
|
||||||
application/vnd.ms-fontobject
|
application/vnd.ms-fontobject
|
||||||
application/vnd.ms-opentype
|
application/vnd.ms-opentype
|
||||||
application/x-elc
|
|
||||||
application/x-font-ttf
|
|
||||||
application/xml
|
application/xml
|
||||||
audio/midi
|
audio/midi
|
||||||
|
font/otf
|
||||||
|
font/sfnt
|
||||||
|
font/ttf
|
||||||
|
font/woff
|
||||||
|
font/woff2
|
||||||
image/apng
|
image/apng
|
||||||
image/avif
|
image/avif
|
||||||
image/gif
|
image/gif
|
||||||
|
@ -38,10 +40,10 @@ class Site < Sequel::Model
|
||||||
image/x-xcf
|
image/x-xcf
|
||||||
message/rfc822
|
message/rfc822
|
||||||
text/cache-manifest
|
text/cache-manifest
|
||||||
text/cache-manifest
|
|
||||||
text/css
|
text/css
|
||||||
text/csv
|
text/csv
|
||||||
text/html
|
text/html
|
||||||
|
text/javascript
|
||||||
text/plain
|
text/plain
|
||||||
text/tsv
|
text/tsv
|
||||||
text/xml
|
text/xml
|
||||||
|
@ -77,8 +79,8 @@ class Site < Sequel::Model
|
||||||
INDEX_HTML_REGEX = /\/?index.html$/
|
INDEX_HTML_REGEX = /\/?index.html$/
|
||||||
ROOT_INDEX_HTML_REGEX = /^\/?index.html$/
|
ROOT_INDEX_HTML_REGEX = /^\/?index.html$/
|
||||||
MAX_COMMENT_SIZE = 420 # Used to be the limit for Facebook.. no comment (PUN NOT INTENDED).
|
MAX_COMMENT_SIZE = 420 # Used to be the limit for Facebook.. no comment (PUN NOT INTENDED).
|
||||||
MAX_FOLLOWS = 1000
|
MAX_FOLLOWS = 2000
|
||||||
|
|
||||||
BROWSE_MINIMUM_VIEWS = 100
|
BROWSE_MINIMUM_VIEWS = 100
|
||||||
BROWSE_MINIMUM_FOLLOWER_VIEWS = 10_000
|
BROWSE_MINIMUM_FOLLOWER_VIEWS = 10_000
|
||||||
|
|
||||||
|
|
|
@ -2316,7 +2316,6 @@ pre, code {
|
||||||
.chat-box {
|
.chat-box {
|
||||||
height: calc(100vh - 180px);
|
height: calc(100vh - 180px);
|
||||||
overflow-y: scroll;
|
overflow-y: scroll;
|
||||||
padding: 10px;
|
|
||||||
background-color: #1d1f21;
|
background-color: #1d1f21;
|
||||||
font-weight: 300;
|
font-weight: 300;
|
||||||
font-size: 13.5px;
|
font-size: 13.5px;
|
||||||
|
|
|
@ -1,22 +1,26 @@
|
||||||
<% site_followings = site.followings_dataset.count %>
|
<% site_followings_count = site.followings_dataset.count %>
|
||||||
<% if (!is_current_site && site_followings > 0) || is_current_site %>
|
<% if (!is_current_site && site_followings_count > 0) || is_current_site %>
|
||||||
<div class="following-list">
|
<div class="following-list">
|
||||||
<h3><a href="/site/<%= site.username %>/follows"><%= is_current_site ? 'Sites you follow' : 'This site follows' %></a></h3>
|
<h3><a href="/site/<%= site.username %>/follows"><%= is_current_site ? 'Sites you follow' : 'This site follows' %></a></h3>
|
||||||
<% if site_followings == 0 %>
|
<% if site_followings_count == 0 %>
|
||||||
<p>You are not following any sites yet. Add some by <a href="/browse">browsing sites</a> or looking at your tags.
|
<p>You are not following any sites yet. Add some by <a href="/browse">browsing sites</a> or looking at your tags.
|
||||||
<% else %>
|
<% else %>
|
||||||
<% site.followings_dataset.select(:site_id).all.each do |following| %>
|
<% site.followings_dataset.select(:site_id).limit(Site::MAX_DISPLAY_FOLLOWS).each do |following| %>
|
||||||
<a href="/site/<%= following.site_dataset.select(:username).first.username %>" title="<%= following.site.title %>"><img src="<%= following.site.screenshot_url 'index.html', '50x50' %>" class="avatar"></a>
|
<a href="/site/<%= following.site_dataset.select(:username).first.username %>" title="<%= following.site.title %>"><img src="<%= following.site.screenshot_url 'index.html', '50x50' %>" class="avatar"></a>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
<% if Site::MAX_DISPLAY_FOLLOWS < site_followings_count %>
|
||||||
|
<a href="/site/<%= site.username %>/followers"><strong>see more <i class="fa fa-arrow-right"></i></strong></a>
|
||||||
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% site_follows = site.follows_dataset.count %>
|
<% site_follows_count = site.follows_dataset.count %>
|
||||||
<% if (!is_current_site && site_follows > 0) || is_current_site %>
|
<% if (!is_current_site && site_follows_count > 0) || is_current_site %>
|
||||||
<div class="follower-list">
|
<div class="follower-list">
|
||||||
<h3><a href="/site/<%= site.username %>/followers">Followers</a></h3>
|
<h3><a href="/site/<%= site.username %>/followers">Followers</a></h3>
|
||||||
<% if site_follows == 0 %>
|
<% if site_follows_count == 0 %>
|
||||||
No followers yet.
|
No followers yet.
|
||||||
<% else %>
|
<% else %>
|
||||||
<% site_profile_follows_actioning_ids = site.profile_follows_actioning_ids %>
|
<% site_profile_follows_actioning_ids = site.profile_follows_actioning_ids %>
|
||||||
|
|
|
@ -111,10 +111,10 @@
|
||||||
|
|
||||||
|
|
||||||
<div class="row editor">
|
<div class="row editor">
|
||||||
<div class="col left-col" style="width: 66%;">
|
<div class="col left-col" style="width: 70%;">
|
||||||
<div id="editor"><h3>Loading...</h3></div>
|
<div id="editor"><h3>Loading...</h3></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col right-col chat-container" style="width: 33%;">
|
<div class="col right-col chat-container" style="width: 30%;">
|
||||||
<div class="resize-handle"></div>
|
<div class="resize-handle"></div>
|
||||||
<div id="chat-box" class="chat-box">
|
<div id="chat-box" class="chat-box">
|
||||||
<div class="bot-message message">
|
<div class="bot-message message">
|
||||||
|
|
|
@ -7,8 +7,8 @@
|
||||||
<div class="dialogue" style="top: 20px; left: 360px">
|
<div class="dialogue" style="top: 20px; left: 360px">
|
||||||
Your Neocities web directory already includes an image called <strong>neocities.png</strong>.
|
Your Neocities web directory already includes an image called <strong>neocities.png</strong>.
|
||||||
</div>
|
</div>
|
||||||
<div class="dialogue" style="top: 145px; left: 390px; width:200px">
|
<div class="dialogue" style="top: 145px; left: 360px; width:250px">
|
||||||
Add it to your page like so: <pre><code class="html"><img src="/neocities.png"></code></pre>
|
Add it to your page: <pre><code class="html"><img src="/neocities.png"></code></pre>
|
||||||
</div>
|
</div>
|
||||||
<div class="dialogue" style="top: 230px; left: 420px">
|
<div class="dialogue" style="top: 230px; left: 420px">
|
||||||
That's it! No closing tag needed for images.
|
That's it! No closing tag needed for images.
|
||||||
|
|
|
@ -18,23 +18,40 @@
|
||||||
$('h3#sitePreview').css('display', 'none')
|
$('h3#sitePreview').css('display', 'none')
|
||||||
$('.preview').css('margin-top', '20px')
|
$('.preview').css('margin-top', '20px')
|
||||||
|
|
||||||
$('#saveToSite').on('click', function() {
|
$('#saveToSite').on('click', function(event) {
|
||||||
|
event.preventDefault()
|
||||||
|
|
||||||
|
var formData = new FormData()
|
||||||
|
var fileContent = sessionStorage.getItem('tutorialHtml')
|
||||||
|
formData.append('index.html', new File([fileContent], 'index.html', { type: 'text/html' }))
|
||||||
|
formData.append('csrf_token', '<%= escape_javascript csrf_token %>')
|
||||||
|
formData.append('username', '<%= escape_javascript current_site.username %>')
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: '/site_files/upload?csrf_token=<%= Rack::Utils.escape csrf_token %>&filename=<%= Rack::Utils.escape 'index.html' %>&site_id=<%= current_site.id %>',
|
url: '/api/upload',
|
||||||
data: sessionStorage.getItem('tutorialHtml'),
|
data: formData,
|
||||||
processData: false,
|
processData: false,
|
||||||
contentType: false,
|
contentType: false,
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
error: function(jqXHR, textStatus, errorThrown) {
|
error: function(jqXHR, textStatus, errorThrown) {
|
||||||
alert('There has been an error saving your file, please try again. If it continues to fail, make a copy of the file locally so you don\'t lose your changes!')
|
var errorMessage = 'There has been an error saving your file, please try again. If it continues to fail, make a copy of the file locally so you don\'t lose your changes!'
|
||||||
|
|
||||||
|
if(jqXHR.responseText) {
|
||||||
|
try {
|
||||||
|
// Attempt to parse the JSON responseText to get the error message
|
||||||
|
var parsedResponse = JSON.parse(jqXHR.responseText);
|
||||||
|
errorMessage += ' ERROR MESSAGE: ' + parsedResponse.message;
|
||||||
|
alert(errorMessage)
|
||||||
|
} catch (error) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
alert(errorMessage)
|
||||||
},
|
},
|
||||||
success: function(response){
|
success: function(response, textStatus, xhr){
|
||||||
window.location = '/tutorial/html/10'
|
window.location = '/tutorial/html/10'
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
return false
|
|
||||||
})
|
})
|
||||||
|
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Add table
Reference in a new issue