1
0
mirror of https://github.com/lxsang/antd-web-apps synced 2024-11-20 02:18:20 +01:00

use afx in blog

This commit is contained in:
lxsang 2020-09-18 13:17:43 +02:00
parent 073337eabe
commit 6a64670786
6 changed files with 357 additions and 395 deletions

View File

@ -1,126 +1,135 @@
var scheme = undefined;
String.prototype.__ = function()
{
return this
}
function subscribe(prefix)
{
OS.GUI.workspace = undefined;
String.prototype.__ = function () {
return this;
};
function subscribe(prefix) {
if (!OS.GUI.workspace) OS.GUI.workspace = $("body");
if (scheme) return;
// get scheme
$.get(prefix + "/rst/subscribe.html")
.done(function (d) {
scheme = $.parseHTML(d)
var obs = riot.observable()
$(scheme).css("visibility","hidden")
$("#desktop" ).append(scheme)
scheme = $.parseHTML(d);
var obs = new OS.API.Announcer();
$(scheme).css("visibility", "hidden");
$("body").append(scheme);
obs.on("exit", function () {
$(scheme).remove()
scheme = undefined
})
$(scheme).remove();
scheme = undefined;
});
obs.on("rendered", function (d) {
$(".afx-window-title", scheme).html("Subscribe")
console.log("rednered");
$(".afx-window-title", scheme).html("Subscribe");
$("[data-id='send']", scheme).click(function () {
var status = $("[data-id='status']", scheme)
var status = $("[data-id='status']", scheme);
status.html("");
var els = $("[data-class='data']", scheme)
var data = {}
var els = $("[data-class='data']", scheme);
var data = {};
for (var i = 0; i < els.length; i++)
data[els[i].name] = $(els[i]).val()
if(data.email == "" || data.subject == "" || data.content == "" || data.name == "")
data[els[i].name] = $(els[i]).val();
if (
data.email == "" ||
data.subject == "" ||
data.content == "" ||
data.name == ""
)
return status.html("Please enter all the fields");
var re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
if (!re.test(String(data.email).toLowerCase()))
return status.html("Email is not correct");
$.ajax({
type: 'POST',
type: "POST",
url: prefix + "/service/subscribe",
contentType: 'application/json',
contentType: "application/json",
data: JSON.stringify(data),
dataType: 'json',
success: null
}).done(function(r){
if(r.error)
{
console.log(r.error)
alert(r.error)
dataType: "json",
success: null,
})
.done(function (r) {
if (r.error) {
console.log(r.error);
alert(r.error);
} else {
obs.trigger("exit");
alert("You have been subscribed. Thanks");
}
else
{
obs.trigger("exit")
alert("You have been subscribed. Thanks")
}
}).fail(function(e, s){
console.log(e)
alert("Error: " + e)
})
})
$(scheme).css("visibility","visible")
})
riot.mount(scheme, {observable:obs})
.fail(function (e, s) {
console.log(e);
alert("Error: " + e);
});
});
$(scheme).css("visibility", "visible");
});
scheme[0].uify(obs, true);
})
.fail(function () {
alert("Cannot get the form");
})
});
}
function mailtoMe(prefix)
{
function mailtoMe(prefix) {
if (!OS.GUI.workspace) OS.GUI.workspace = $("body");
if (scheme) return;
// get scheme
$.get(prefix + "/rst/sendto.html")
.done(function (d) {
scheme = $.parseHTML(d)
var obs = riot.observable()
$(scheme).css("visibility","hidden")
$("#desktop" ).append(scheme)
scheme = $.parseHTML(d);
var obs = new OS.API.Announcer();
$(scheme).css("visibility", "hidden");
$("body").append(scheme);
obs.on("exit", function () {
$(scheme).remove()
scheme = undefined
})
$(scheme).remove();
scheme = undefined;
});
obs.on("rendered", function (d) {
$(".afx-window-title", scheme).html("Send me an email")
$(".afx-window-title", scheme).html("Send me an email");
$("[data-id='send']", scheme).click(function () {
var status = $("[data-id='status']", scheme)
var status = $("[data-id='status']", scheme);
status.html("");
var els = $("[data-class='data']", scheme)
var data = {}
var els = $("[data-class='data']", scheme);
var data = {};
for (var i = 0; i < els.length; i++)
data[els[i].name] = $(els[i]).val()
if(data.email == "" || data.subject == "" || data.content == "" || data.name == "")
data[els[i].name] = $(els[i]).val();
if (
data.email == "" ||
data.subject == "" ||
data.content == "" ||
data.name == ""
)
return status.html("Please enter all the fields");
var re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
if (!re.test(String(data.email).toLowerCase()))
return status.html("Email is not correct");
$.ajax({
type: 'POST',
type: "POST",
url: prefix + "/service/sendmail",
contentType: 'application/json',
contentType: "application/json",
data: JSON.stringify(data),
dataType: 'json',
success: null
}).done(function(r){
if(r.error)
{
console.log(r.error)
alert(r.error)
dataType: "json",
success: null,
})
.done(function (r) {
if (r.error) {
console.log(r.error);
alert(r.error);
} else {
obs.trigger("exit");
alert("Email sent. Thank");
}
else
{
obs.trigger("exit")
alert("Email sent. Thank")
}
}).fail(function(){
alert("Service unavailable at the moment")
})
})
$(scheme).css("visibility","visible")
})
riot.mount(scheme, {observable:obs})
.fail(function () {
alert("Service unavailable at the moment");
});
});
$(scheme).css("visibility", "visible");
});
scheme[0].uify(obs, true);
})
.fail(function () {
alert("Cannot get the form");
})
});
}

View File

@ -1,4 +1,5 @@
html,body{
html,
body {
margin: 0;
padding: 0;
font-family: "Ubuntu";
@ -113,12 +114,11 @@ button{
border-radius: 5px;
padding: 5px;
margin-right: 10px;
box-shadow: 1px 1px 1px #9f9F9F;
box-shadow: 1px 1px 1px #9f9f9f;
}
#container .card {
display: flex;
flex-direction: row;
}
#container .mobile {
display: flex;
@ -132,7 +132,7 @@ button{
margin-right: 10px;
width: 120px;
flex: 1 0 auto;
color:#3170B2;
color: #3170b2;
text-align: right;
}
#container .card .side .fb-like {
@ -151,7 +151,8 @@ button{
width: 100%;
text-align: left;
}
#container .mobile .side .fb-like, #container .mobile .side .twitter-share-button {
#container .mobile .side .fb-like,
#container .mobile .side .twitter-share-button {
border: 0;
}
#container .card .side .date {
@ -214,7 +215,7 @@ button{
}
#container .blogentry a {
text-decoration: none;
color:#3170B2;
color: #3170b2;
}
#container .blogentry hr {
display: block;
@ -230,7 +231,8 @@ button{
text-align: center;
border-collapse: collapse;
}
#container .blogentry table th,#container .blogentry table td{
#container .blogentry table th,
#container .blogentry table td {
border: 1px solid #878787;
padding: 3px;
padding-left: 10px;
@ -240,7 +242,8 @@ button{
margin: 0;
text-align: left;
}
#container .blogentry pre table td, #container .blogentry pre table td{
#container .blogentry pre table td,
#container .blogentry pre table td {
border: 0;
padding: 0;
}
@ -354,7 +357,7 @@ div.detail a:before{
font-size: 16px;
content: "\f039";
font-family: "FontAwesome";
line-height: 2.0;
line-height: 2;
padding-left: 8px;
color: #878887;
}
@ -374,7 +377,7 @@ div.notfound p:before{
font-size: 16px;
content: "\f06a";
font-family: "FontAwesome";
line-height: 2.0;
line-height: 2;
padding-right: 8px;
}
div.notfound blockquote {
@ -437,8 +440,8 @@ div.commentform {
#container h1.commentsec {
text-align: center;
border-top: 1px dashed #3170B2;
color:#3170B2;
border-top: 1px dashed #3170b2;
color: #3170b2;
padding-top: 10px;
padding-bottom: 10px;
}
@ -455,88 +458,16 @@ div.time-travel a{
font-size: 16px;
text-decoration: none;
flex: 1;
color:#3170B2;
}
afx-app-window div.afx-window-wrapper{
border:1px solid #a6a6a6;
/*box-shadow: 1px 1px 1px #cbcbcb;*/
box-shadow: 1px 1px 1px #9f9F9F;
border-radius: 5px;
background-color:#dfdfdf;
padding:0;
display: flex;
flex-direction: column;
width: 100%;
height: 100%;
}
afx-app-window.unactive > div.afx-window-wrapper{
background-color: #f6f6f6;
}
afx-app-window ul.afx-window-top{
margin: 0;
padding: 0;
width: 100%;
padding:0;
height: 20px;
border-bottom: 1px solid #a6a6a6;
}
afx-app-window ul.afx-window-top li{
list-style: none;
margin-left: 3px;
margin-top:4px;
}
afx-app-window ul.afx-window-top .afx-window-close,.afx-window-minimize,.afx-window-maximize{
width: 11px;
height: 11px;
border-radius: 10px;
}
afx-app-window ul li.afx-window-close{
background-color: #Fc605b;
float:left;
}
afx-app-window ul li.afx-window-minimize{
background-color: #fec041;
float:left;
}
afx-app-window ul li.afx-window-maximize{
background-color: #35cc4b;
float:left;
}
afx-app-window ul li.afx-window-title{
margin-top:1px;
float:none;
overflow: hidden;
padding-left: 5px;
padding-right: 5px;
text-align: center;
}
afx-app-window div.afx-window-content
{
overflow: hidden;
width: 100%;
background-color: white;
flex-grow: 1;
border-bottom-left-radius: 5px;
border-bottom-right-radius: 5px;
}
afx-app-window div.afx-window-grip{
height: 10px;
width: 10px;
background-color: transparent;
}
afx-hbox.inputbox{
margin-left: 10px;
margin-right: 10px;
border-bottom: 1px solid #e5e5e5;
color: #3170b2;
}
div[data-id="status"] {
padding-left: 10px;
padding-top: 5px;
color: #724841;
}
img {max-width:100%}
img {
max-width: 100%;
}
afx-hbox.inputbox {
border-bottom: 1px solid #e5e5e5;
}

View File

@ -19,9 +19,9 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="<?=HTTP_ROOT?>/rst/ubuntu-regular.css" />
<link rel="stylesheet" type="text/css" href="<?=HTTP_ROOT?>/rst/font-awesome.css" />
<link rel="stylesheet" type="text/css" href="<?=HTTP_ROOT?>/rst/afx.css" />
<link rel="stylesheet" type="text/css" href="<?=HTTP_ROOT?>/assets/style.css" />
<script src="<?=HTTP_ROOT?>/rst/gscripts/riot.min.js"> </script>
<script src="<?=HTTP_ROOT?>/rst/resources/antos_tags.js"></script>
<script src="<?=HTTP_ROOT?>/rst/afx.js"> </script>
<script src="<?=HTTP_ROOT?>/rst/gscripts/jquery-3.2.1.min.js"> </script>
<script src="<?=HTTP_ROOT?>/assets/main.js"></script>
<meta property="og:image" content="" />

View File

@ -1,11 +1,10 @@
#! /bin/bash
BRANCH="ci"
PRJ="antos"
DEST="/opt/www/htdocs/os"
DEST="/opt/www/htdocs/"
# /opt/www/htdocs
REPO="https://github.com/lxsang/$PRJ.git"
if [ ! -z $1 ]; then
BRANCH="$1"
fi
@ -24,9 +23,9 @@ fi
git clone -b "$BRANCH" --single-branch --depth=1 "$REPO"
cd "$PRJ" || (echo "Unable to change directory to source code folder" && exit 1)
npm i @types/jquery
mkdir -p "$DEST"
mkdir -p "$DEST/os"
BUILDDIR="$DEST" make release
mkdir -p "$DEST/grs"
BUILDDIR="$DEST" make standalone_tags
echo "Done!"
} 2>&1 | tee "/opt/www/htdocs/ci/log/${PRJ}_${BRANCH}.txt"

View File

@ -1,4 +1,13 @@
<afx-app-window apptitle="Send me an email" minimizable="false" resizable = "false" width="450" height="350">
<afx-app-window
apptitle="Send me an email"
minimizable="false"
resizable="false"
width="450"
height="350"
>
<afx-hbox>
<div data-width="10"></div>
<afx-vbox>
<div data-height="5"></div>
<afx-hbox data-height="20" class="inputbox">
@ -24,4 +33,6 @@
</afx-hbox>
<div data-height="5"></div>
</afx-vbox>
<div data-width="10"></div>
</afx-hbox>
</afx-app-window>

View File

@ -1,8 +1,18 @@
<afx-app-window apptitle="Subscribe" minimizable="false" resizable = "false" width="350" height="170">
<afx-app-window
apptitle="Subscribe"
minimizable="false"
resizable="false"
width="350"
height="170"
>
<afx-hbox>
<div data-width="10"></div>
<afx-vbox>
<div data-height="5"></div>
<afx-hbox data-height="50" class="inputbox">
<div styple="padding-left:5px;padding-right:5px;">Subscribe to receive an email when new post is published</div>
<div styple="padding-left:5px;padding-right:5px;">
Subscribe to receive an email when new post is published
</div>
</afx-hbox>
<div data-height="5"></div>
<afx-hbox data-height="20" class="inputbox">
@ -21,4 +31,6 @@
</afx-hbox>
<div data-height="5"></div>
</afx-vbox>
<div data-width="10"></div>
</afx-hbox>
</afx-app-window>