1
0
Fork 0
mirror of https://github.com/Alamantus/Lexiconga.git synced 2025-10-01 10:56:28 +02:00

Compare commits

..

No commits in common. "d5ccd2e7563ce94515fb2f1000316be151b25079" and "90ac6b8a2661dc2a067b7b1f6849db45f7a690e7" have entirely different histories.

14 changed files with 63 additions and 123 deletions

View file

@ -33,7 +33,7 @@
"type": "image/png" "type": "image/png"
} }
], ],
"start_url": "/", "start_url": "/lexiconga/",
"display": "standalone", "display": "standalone",
"orientation": "portrait", "orientation": "portrait",
"background_color": "#e6cfaa", "background_color": "#e6cfaa",

View file

@ -11,7 +11,7 @@
"watch-js": "parcel watch template-index.html offline.html template-view.html template-passwordreset.html --no-hmr --public-url /lexiconga/", "watch-js": "parcel watch template-index.html offline.html template-view.html template-passwordreset.html --no-hmr --public-url /lexiconga/",
"watch-php": "cpx \"src/php/**/{*,.*}\" dist -v -w", "watch-php": "cpx \"src/php/**/{*,.*}\" dist -v -w",
"bundle": "npm run process-images && npm run bundle-js && npm run copy-files && npm run copy-php", "bundle": "npm run process-images && npm run bundle-js && npm run copy-files && npm run copy-php",
"bundle-js": "parcel build template-index.html offline.html template-view.html template-passwordreset.html --no-source-maps", "bundle-js": "parcel build template-index.html offline.html template-view.html template-passwordreset.html",
"copy-files": "cpx \"node_modules/upup/dist/*.min.js\" dist -v", "copy-files": "cpx \"node_modules/upup/dist/*.min.js\" dist -v",
"copy-php": "cpx \"src/php/**/{*,.*}\" dist", "copy-php": "cpx \"src/php/**/{*,.*}\" dist",
"process-images": "node dev/resize-images.js", "process-images": "node dev/resize-images.js",

View file

@ -18,7 +18,6 @@ export function createNewDictionary() {
export function changeDictionary(dictionary) { export function changeDictionary(dictionary) {
dictionary = typeof dictionary.target !== 'undefined' ? dictionary.target.value : dictionary; dictionary = typeof dictionary.target !== 'undefined' ? dictionary.target.value : dictionary;
if (dictionary !== window.currentDictionary.externalID) { if (dictionary !== window.currentDictionary.externalID) {
addMessage('Loading Dictionary...');
request({ request({
action: 'change-dictionary', action: 'change-dictionary',
dictionary, dictionary,

View file

@ -1,5 +1,4 @@
import { setupLoginModal, setupChangeDictionary, setupCreateNewDictionary, setupDeletedDictionaryChangeModal, setupMakePublic } from "./setupListeners"; import { setupLoginModal, setupChangeDictionary, setupCreateNewDictionary, setupDeletedDictionaryChangeModal, setupMakePublic } from "./setupListeners";
import { getPublicLink } from "./utilities";
import { request } from "./helpers"; import { request } from "./helpers";
export function renderLoginForm() { export function renderLoginForm() {
@ -57,24 +56,20 @@ export function renderLoginForm() {
export function renderMakePublic() { export function renderMakePublic() {
const editSettingsTab = document.getElementById('editSettingsTab'); const editSettingsTab = document.getElementById('editSettingsTab');
const { isPublic } = window.currentDictionary.settings; const { isPublic } = window.currentDictionary.settings;
let waitForSync = setInterval(() => { const { externalID } = window.currentDictionary;
if (window.currentDictionary.hasOwnProperty('externalID') && !isNaN(window.currentDictionary.externalID)) { const editSettingsTabHTML = `<label>Make Public
clearInterval(waitForSync); <input type="checkbox" id="editIsPublic"${isPublic ? ' checked' : ''}><br>
const editSettingsTabHTML = `<label>Make Public <small>Checking this box will make this public via a link you can share with others.</small>
<input type="checkbox" id="editIsPublic"${isPublic ? ' checked' : ''}><br> </label>
<small>Checking this box will make this public via a link you can share with others.</small> <p id="publicLinkDisplay" style="${!isPublic ? 'display:none;': ''}margin-left:20px;">
</label> <strong>Public Link:</strong><br>
<p id="publicLinkDisplay" style="${!isPublic ? 'display:none;': ''}margin-left:20px;"> <input readonly id="publicLink" value="${document.domain + window.location.pathname + (externalID ? externalID.toString() : '')}">
<strong>Public Link:</strong><br> <a class="small button" id="publicLinkCopy">Copy</a>
<input readonly id="publicLink" value="${getPublicLink()}"> </p>
<a class="small button" id="publicLinkCopy">Copy</a> `;
</p> editSettingsTab.innerHTML += editSettingsTabHTML;
`;
editSettingsTab.innerHTML += editSettingsTabHTML; setupMakePublic();
setupMakePublic();
}
}, 100);
} }
export function renderAccountSettings() { export function renderAccountSettings() {

View file

@ -1,7 +1,7 @@
import { addMessage } from "../utilities"; import { addMessage } from "../utilities";
import { saveDictionary, clearDictionary } from "../dictionaryManagement"; import { saveDictionary, clearDictionary } from "../dictionaryManagement";
import { request } from "./helpers"; import { request } from "./helpers";
import { saveToken, dictionaryIsDefault, getPublicLink } from "./utilities"; import { saveToken, dictionaryIsDefault } from "./utilities";
import { renderAll } from "../render"; import { renderAll } from "../render";
import { sortWords } from "../wordManagement"; import { sortWords } from "../wordManagement";
import { getLocalDeletedWords, clearLocalDeletedWords, saveDeletedWordsLocally } from "./utilities"; import { getLocalDeletedWords, clearLocalDeletedWords, saveDeletedWordsLocally } from "./utilities";
@ -37,14 +37,8 @@ export function performSync(remoteDictionary) {
syncWords(remoteDictionary.words, remoteDictionary.deletedWords).then(success => { syncWords(remoteDictionary.words, remoteDictionary.deletedWords).then(success => {
if (success) { if (success) {
renderAll(); renderAll();
document.getElementById('accountSettingsChangeDictionary').value = window.currentDictionary.externalID; document.getElementById('accountSettingsChangeDictionary').value = window.currentDictionary.externalID;
if (document.getElementById('publicLink')) { document.getElementById('publicLinkDisplay').style.display = window.currentDictionary.settings.isPublic ? '' : 'none';
document.getElementById('publicLink').value = getPublicLink();
}
if (document.getElementById('publicLinkDisplay')) {
document.getElementById('publicLinkDisplay').style.display = window.currentDictionary.settings.isPublic ? '' : 'none';
}
} else { } else {
console.error('word sync failed'); console.error('word sync failed');
} }

View file

@ -21,22 +21,6 @@ export function dictionaryIsDefault() {
return JSON.stringify(defaultDictionary) === JSON.stringify(currentDictionary); return JSON.stringify(defaultDictionary) === JSON.stringify(currentDictionary);
} }
export function getPublicLink() {
const { externalID } = window.currentDictionary;
let path;
if (externalID) {
path = window.location.pathname.match(new RegExp(externalID + '$'))
? window.location.pathname
: (window.location.pathname.indexOf(externalID) > -1
? window.location.pathname.substring(0, window.location.pathname.indexOf(externalID)) + externalID
: window.location.pathname + externalID
);
} else {
path = '';
}
return 'https://' + document.domain + path;
}
export function saveDeletedWordsLocally(wordIds) { export function saveDeletedWordsLocally(wordIds) {
let storedDeletedWords = getLocalDeletedWords(); let storedDeletedWords = getLocalDeletedWords();
wordIds.forEach(wordId => { wordIds.forEach(wordId => {

View file

@ -18,7 +18,6 @@ import { getPaginationData } from './pagination';
import { getOpenEditForms, parseReferences } from './wordManagement'; import { getOpenEditForms, parseReferences } from './wordManagement';
import { renderAd } from './ads'; import { renderAd } from './ads';
import ipaTableFile from './KeyboardFire/phondue/ipa-table.html'; import ipaTableFile from './KeyboardFire/phondue/ipa-table.html';
import { getPublicLink } from './account/utilities';
export function renderAll() { export function renderAll() {
renderTheme(); renderTheme();
@ -55,13 +54,12 @@ export function renderName() {
shareLink.id = 'dictionaryShare'; shareLink.id = 'dictionaryShare';
shareLink.classList.add('button'); shareLink.classList.add('button');
shareLink.style.float = 'right'; shareLink.style.float = 'right';
shareLink.href = getPublicLink(); shareLink.href = window.location.pathname.match(new RegExp(window.currentDictionary.externalID + '$')) ? window.location.pathname
: window.location.pathname.substring(0, window.location.pathname.indexOf(window.currentDictionary.externalID)) + window.currentDictionary.externalID;
shareLink.target = '_blank'; shareLink.target = '_blank';
shareLink.title = 'Public Link to Dictionary'; shareLink.title = 'Public Link to Dictionary';
shareLink.innerHTML = '&#10150;'; shareLink.innerHTML = '&#10150;';
name.parentElement.insertBefore(shareLink, name); name.parentElement.insertBefore(shareLink, name);
} else if (isPublic && shareLinkElement) {
shareLinkElement.href = getPublicLink();
} else if (!isPublic && shareLinkElement) { } else if (!isPublic && shareLinkElement) {
shareLinkElement.parentElement.removeChild(shareLinkElement); shareLinkElement.parentElement.removeChild(shareLinkElement);
} }
@ -195,7 +193,8 @@ export function renderWords() {
wordId: originalWord.wordId, wordId: originalWord.wordId,
}); });
const homonymnNumber = getHomonymnNumber(originalWord); const homonymnNumber = getHomonymnNumber(originalWord);
const shareLink = window.currentDictionary.hasOwnProperty('externalID') ? getPublicLink() + '/' + word.wordId : ''; const shareLink = window.currentDictionary.hasOwnProperty('externalID')
? window.location.pathname + window.currentDictionary.externalID + '/' + word.wordId : '';
wordsHTML += renderAd(displayIndex); wordsHTML += renderAd(displayIndex);

View file

@ -18,4 +18,21 @@
@import 'scss/themes/yellow'; @import 'scss/themes/yellow';
@import 'scss/themes/red'; @import 'scss/themes/red';
@import 'scss/themes/mint'; @import 'scss/themes/mint';
@import 'scss/themes/grape'; @import 'scss/themes/grape';
html, body {
margin: 0;
font-family: $font;
transition: all 0.2s ease-in;
* {
transition: all 0.2s ease-in;
box-sizing: border-box;
}
}
input:not([type="checkbox"]),
select,
textarea {
font-size: 16px;
}

View file

@ -59,7 +59,7 @@ VALUES ($new_id, ?, ?, ?, ?)";
public function changeCurrent ($user, $dictionary) { public function changeCurrent ($user, $dictionary) {
$update_query = 'UPDATE users SET current_dictionary=? WHERE id=?'; $update_query = 'UPDATE users SET current_dictionary=? WHERE id=?';
$update = $this->db->query($update_query, array($dictionary, $user)); $update = $this->db->query($update_query, array($dictionary, $user));
if (trim($this->db->last_error_info[2]) == '') { if ($update->rowCount() > 0) {
return $dictionary; return $dictionary;
} }
return false; return false;

View file

@ -1,12 +1,5 @@
<?php <?php
require_once(realpath(dirname(__FILE__) . '/./api/Response.php')); require_once(realpath(dirname(__FILE__) . '/./api/Response.php'));
$show_upgrade_screen = false;
if ($show_upgrade_screen) {
$html = '<h1>Code Update in Progress</h1><p>Please refresh the page in 10 minutes.</p>';
return Response::html($html);
}
$view = isset($_GET['view']) ? $_GET['view'] : false; $view = isset($_GET['view']) ? $_GET['view'] : false;
switch ($view) { switch ($view) {
@ -119,7 +112,7 @@ switch ($view) {
oldLoad && oldLoad(); oldLoad && oldLoad();
if (UpUp) { if (UpUp) {
UpUp.start({ UpUp.start({
'cache-version': '2.0.2', 'cache-version': '2.0.0',
'content-url': 'offline.html', 'content-url': 'offline.html',
'assets': [ 'assets': [
\"" . implode('","', $files) . "\" \"" . implode('","', $files) . "\"

View file

@ -1,15 +1,3 @@
html, body {
margin: 0;
font-family: $font;
font-size: 13pt;
transition: all 0.2s ease-in;
* {
transition: all 0.2s ease-in;
box-sizing: border-box;
}
}
header { header {
display: block; display: block;
padding: 5px $general-padding; padding: 5px $general-padding;

View file

@ -8,12 +8,6 @@ p, span {
} }
} }
input:not([type="checkbox"]),
select,
textarea {
font-size: 12pt;
}
label { label {
display: block; display: block;
font-weight: bold; font-weight: bold;
@ -30,7 +24,7 @@ label {
input:not([type="checkbox"]):not([type="radio"]) { input:not([type="checkbox"]):not([type="radio"]) {
padding-bottom: 2px; padding-bottom: 2px;
line-height: 1.3; line-height: 130%;
} }
input:not([type="checkbox"]):not([type="radio"]), input:not([type="checkbox"]):not([type="radio"]),
@ -39,27 +33,23 @@ label {
width: 100%; width: 100%;
} }
textarea {
min-height: 100px;
}
.label-button { .label-button {
display: inline-block; display: inline-block;
padding: 3px 9px; padding: 3px 9px;
border-radius: 3px; border-radius: 3px;
line-height: 1.5; line-height: 30px;
cursor: pointer; cursor: pointer;
user-select: none; user-select: none;
font-size: 80%; font-size: 80%;
font-weight: normal; font-weight: normal;
float: right; float: right;
cursor: pointer; cursor: pointer;
line-height: 0.85 !important; line-height: 80% !important;
padding: 3px 3px 5px; padding: 3px 3px 5px;
&.small { &.small {
font-size: 80%; font-size: 80%;
line-height: 0.8; line-height: 25px;
} }
} }
@ -67,18 +57,18 @@ label {
display: inline-block; display: inline-block;
padding: 3px 9px; padding: 3px 9px;
border-radius: 3px; border-radius: 3px;
line-height: 1.5; line-height: 30px;
cursor: pointer; cursor: pointer;
user-select: none; user-select: none;
font-size: 70%; font-size: 70%;
font-weight: normal; font-weight: normal;
cursor: pointer; cursor: pointer;
line-height: 0.8 !important; line-height: 70% !important;
padding: 2px 2px 4px; padding: 2px 2px 4px;
&.small { &.small {
font-size: 80%; font-size: 80%;
line-height: 0.8; line-height: 25px;
} }
} }
} }
@ -91,15 +81,11 @@ ul {
display: inline-block; display: inline-block;
padding: 3px 9px; padding: 3px 9px;
border-radius: 3px; border-radius: 3px;
line-height: 1.5; line-height: 30px;
&.small { &.small {
font-size: 80%; font-size: 80%;
line-height: 1.3; line-height: 25px;
}
&+.tag {
margin-top: 5px;
} }
} }
@ -109,28 +95,24 @@ span .tag {
display: inline-block; display: inline-block;
padding: 3px 9px; padding: 3px 9px;
border-radius: 3px; border-radius: 3px;
line-height: 1.5; line-height: 30px;
&.small { &.small {
font-size: 80%; font-size: 80%;
line-height: 1.3; line-height: 25px;
} }
&+.tag { &+.tag {
border-left: none; border-left: none;
border-radius: 0 3px 3px 0; border-radius: 0 3px 3px 0;
} }
&+span .tag {
margin-top: 5px;
}
} }
.button { .button {
display: inline-block; display: inline-block;
padding: 3px 9px; padding: 3px 9px;
border-radius: 3px; border-radius: 3px;
line-height: 1.5; line-height: 30px;
cursor: pointer; cursor: pointer;
user-select: none; user-select: none;
text-decoration: none; text-decoration: none;
@ -138,11 +120,7 @@ span .tag {
&.small { &.small {
font-size: 80%; font-size: 80%;
line-height: 1.3; line-height: 25px;
}
&+.button {
margin-top: 5px;
} }
} }

View file

@ -1,8 +1,8 @@
@media (max-width: 750px) { @media (max-width: 750px) {
html, body { html, body {
font-size: 12pt; font-size: 90%;
line-height: 1; line-height: 90%;
} }
header { header {
@ -17,6 +17,7 @@ main {
#sideColumn { #sideColumn {
display: block; display: block;
width: 0; width: 0;
height: block;
margin: 0; margin: 0;
overflow: visible; overflow: visible;
} }

View file

@ -2,7 +2,7 @@
#top { #top {
#title { #title {
width: 150px; font-size: 13pt;
margin-right: 10px; margin-right: 10px;
} }
@ -27,13 +27,12 @@
} }
} }
$mobile-word-form-size: 32px;
#mobileWordFormShow { #mobileWordFormShow {
position: fixed; position: fixed;
top: $header-height - ($mobile-word-form-size / 2); top: $header-height;
left: 0; left: 0;
width: $mobile-word-form-size; width: 32px;
height: $mobile-word-form-size; height: 32px;
display: block; display: block;
border-radius: 0 3px 3px 0; border-radius: 0 3px 3px 0;
font-size: 30px; font-size: 30px;
@ -49,15 +48,10 @@ $mobile-word-form-size: 32px;
display: none; display: none;
width: 95%; width: 95%;
max-width: unset; max-width: unset;
max-height: 85%; top: $header-height + 32px;
top: $header-height + ($mobile-word-form-size / 2);
left: 0; left: 0;
right: 3%; right: 3%;
z-index: 1; z-index: 1;
label:not(:last-child) {
margin-bottom: 10px;
}
} }
#detailsSection { #detailsSection {
@ -66,9 +60,7 @@ $mobile-word-form-size: 32px;
} }
#detailsPanel { #detailsPanel {
width: 100%;
max-height: 300px; max-height: 300px;
padding: 10px 5px;
} }
} }