diff --git a/common/static/css/boofilsic_box.css b/common/static/css/boofilsic_box.css
deleted file mode 100644
index 9a5e2ca3..00000000
--- a/common/static/css/boofilsic_box.css
+++ /dev/null
@@ -1,32 +0,0 @@
-.box {
- position: absolute;
- left: 50%;
- top: 50%;
- transform: translate(-50%, -50%);
- padding: 60px 40px;
- background-color: var(--bright);
- text-align: center;
- min-width: 400px;
-}
-
-.box .sec-msg {
- color: var(--light);
- font-size: smaller;
-}
-
-.box .main-msg {
- margin-bottom: 5px;
-}
-
-.box .logo {
- width: 140px;
- margin-bottom: 60px;
-}
-
-.box p {
- text-align: justify;
-}
-
-/* body {
- filter: grayscale(1);
-} */
diff --git a/common/static/css/boofilsic_browse.css b/common/static/css/boofilsic_browse.css
deleted file mode 100644
index 29312f0d..00000000
--- a/common/static/css/boofilsic_browse.css
+++ /dev/null
@@ -1,734 +0,0 @@
-/* Global */
-
-:root {
- --primary: #00a1cc;
- --secondary: #606c76;
- --light: #ccc;
- --bright: rgb(247, 247, 247);
-}
-
-html {
- /* background-color: #eee; */
- font-size: 55%;
- height: 100%;
-}
-
-body {
- height: 100%;
- margin: 0;
-}
-
-.errorlist {
- color: var(--primary);
- font-size: small;
- font-weight: bold;
- list-style-type: square;
-}
-
-#page-wrapper {
- position: relative;
- min-height: 100vh;
- z-index: 0;
-}
-
-#content-wrapper {
- padding-bottom: 160px;
-}
-
-
-input[type=text]::-ms-clear { display: none; width : 0; height: 0; }
-input[type=text]::-ms-reveal { display: none; width : 0; height: 0; }
-input[type="search"]::-webkit-search-decoration,
-input[type="search"]::-webkit-search-cancel-button,
-input[type="search"]::-webkit-search-results-button,
-input[type="search"]::-webkit-search-results-decoration { display: none; }
-
-footer {
- text-align: center;
-
- margin-bottom: 4px !important;
-
- border-top: var(--bright) solid 2px;
-
- position: absolute !important;
- left: 50%;
- transform: translateX(-50%);
- bottom: 0;
-}
-
-footer a {
- margin: 0 15px;
- font-size: small;
-}
-
-img.emoji {
- height: 20px !important;
- width: 20px !important;
- box-sizing: border-box;
- object-fit: contain;
- position: relative;
- top: 3px;
-}
-
-.more-link {
- font-size: small;
- margin-left: 5px;
-}
-
-.highlight {
- font-weight: bold;
-}
-
-div.dividing-line {
- height: 0;
- width: 100%;
- margin: 40px 0 15px 0;
- border-top: solid 1px var(--light);
-}
-
-.icon-lock svg{
- fill: var(--light);
- height: 12px;
- position: relative;
- top: 1px;
- margin-left: 3px;
-}
-
-textarea::placeholder {
- color: var(--light);
-}
-
-input::placeholder {
- color: var(--light);
-}
-
-.spinner {
- transform: scale(0.4);
- margin: auto;
-}
-
-.lds-spinner {
- color: official;
- display: inline-block;
- position: relative;
- width: 80px;
- height: 80px;
- }
-
- .lds-spinner div {
- transform-origin: 40px 40px;
- animation: lds-spinner 1.2s linear infinite;
- }
-
- .lds-spinner div:after {
- content: " ";
- display: block;
- position: absolute;
- top: 3px;
- left: 37px;
- width: 6px;
- height: 18px;
- border-radius: 20%;
- background: var(--secondary);
- }
-
- .lds-spinner div:nth-child(1) {
- transform: rotate(0deg);
- animation-delay: -1.1s;
- }
-
- .lds-spinner div:nth-child(2) {
- transform: rotate(30deg);
- animation-delay: -1s;
- }
-
- .lds-spinner div:nth-child(3) {
- transform: rotate(60deg);
- animation-delay: -0.9s;
- }
-
- .lds-spinner div:nth-child(4) {
- transform: rotate(90deg);
- animation-delay: -0.8s;
- }
-
- .lds-spinner div:nth-child(5) {
- transform: rotate(120deg);
- animation-delay: -0.7s;
- }
-
- .lds-spinner div:nth-child(6) {
- transform: rotate(150deg);
- animation-delay: -0.6s;
- }
-
- .lds-spinner div:nth-child(7) {
- transform: rotate(180deg);
- animation-delay: -0.5s;
- }
-
- .lds-spinner div:nth-child(8) {
- transform: rotate(210deg);
- animation-delay: -0.4s;
- }
-
- .lds-spinner div:nth-child(9) {
- transform: rotate(240deg);
- animation-delay: -0.3s;
- }
-
- .lds-spinner div:nth-child(10) {
- transform: rotate(270deg);
- animation-delay: -0.2s;
- }
-
- .lds-spinner div:nth-child(11) {
- transform: rotate(300deg);
- animation-delay: -0.1s;
- }
-
- .lds-spinner div:nth-child(12) {
- transform: rotate(330deg);
- animation-delay: 0s;
- }
-
- @keyframes lds-spinner {
- 0% {
- opacity: 1;
- }
-
- 100% {
- opacity: 0;
- }
- }
-
-/* overwrite rating-star plugin makes it readonly */
-.rating-star .jq-star {
- cursor: unset;
-}
-
-/* Nav Bar */
-
-section#navbar {
- background-color: var(--bright);
- box-sizing: border-box;
- padding: 18px 0;
- margin-bottom: 50px;
- border-bottom: var(--light) 0.5px solid;
-
-}
-
-.navbar img.logo {
- width: 100px;
- float: left;
-}
-
-.navbar .search-box {
- height: 32px;
- margin: 5px 0 0 16px;
- width: 50%;
- float: left;
- background-color: white;
-}
-
-.navbar .search-box::placeholder {
- color: var(--light);
-}
-
-.navbar a.nav-link, .navbar a.nav-link:visited {
- font-size: 80%;
- float: right;
- margin-top: 10px;
- color: var(--secondary);
- margin-left: 20px;
-}
-
-.navbar a.nav-link:hover, .navbar a.nav-link:hover:visited {
- color: var(--primary);
-}
-
-/* Main Content Section */
-
-section#content div#main {
- padding: 32px 35px;
- background-color: var(--bright);
- margin-right: 40px;
- width: 75%;
- position: relative;
-}
-
-/* Aside Content Section */
-
-section#content div#aside {
- width: 25%;
-}
-
-.set {
- margin-bottom: 20px;
-}
-
-.set .set-title {
- display: inline-block;
- margin-bottom: 7px;
-}
-.set .set-empty {
- font-size: small;
- margin: 0;
- padding-left: 20px;
-}
-
-.set .set-item-list {
- padding: 8px 25px 0 10px;
-}
-
-.set .set-item {
- text-align: center;
- margin-bottom: 0 !important;
-}
-
-.set .set-item-image {
- max-width: 90px;
- height: 110px;
- object-fit: contain;
-}
-
-.set .set-item-title, .set .set-item-title:visited {
- /* width: 80%; */
- margin: auto;
- line-height: 1.3em;
- font-size: small;
- display: block;
- color: var(--secondary);
-
-}
-
-.set .set-item-title:hover, .set .set-item-title:visited:hover {
- color: var(--primary);
-}
-
-.set .set-content {
- font-size: small;
-}
-
- /* Info Card */
-
-.aside-card {
- background-color: var(--bright);
- padding: 20px 24px 15px 24px;
- margin-bottom: 30px;
-}
-
-.aside-card .clearfix {
- margin-bottom: 15px;
-}
-
-.aside-card .info-avatar {
- width: 72px;
- object-fit: contain;
- float: left;
-}
-
-.aside-card .info-name {
- margin: 0;
- max-width: 120px;
- margin-bottom: 12px;
- padding-left: 8px;
- float: left;
-}
-
-.aside-card .info-brief {
- line-height: 2rem;
- font-size: small;
- overflow-wrap: break-word;
- hyphens: auto;
-}
-
-.aside-card a.report {
- color: var(--light);
- font-size: small;
-}
-
-.aside-card a.follow {
- font-size: small;
- color: var(--secondary);
- margin-right: 10px;
-}
-
-.aside-card .button.add-button {
- margin-top: 10px;
-}
-
-/* Relation Card */
-
-.relation-card {
- padding: 2px;
- margin-bottom: 10px;
-}
-
-.relation-card .relation-label {
- margin: 0;
- margin-bottom: 12px;
- display: inline-block;
-}
-
-.relation-card .relation-user .relation-avatar {
- width: 50px;
-}
-
-.relation-card .relation-user .relation-name {
- display: block;
- font-size: small;
- line-height: 1.8rem;
- /* white-space: nowrap; */
- text-overflow: ellipsis;
- /* max-width: 100px; */
- overflow: hidden;
-}
-
-.relation-user .relation-name .emoji {
- transform: scale(0.8);
-}
-
-.relation-card .relation-user-list {
- margin-bottom: 15px;
-}
-
-.relation-card .relation-user-list .relation-user {
- list-style-type: none;
- text-align: center;
- margin-bottom: 0px !important;
- justify-items: center;
- padding: 0 3px !important;
-}
-
-/* Report Card */
-
-.report-card {
- padding: 2px;
- font-size: small;
-}
-
-.report-card .report-label {
- margin: 0;
-}
-
-.report-card .report-user-link {
- padding: 0 5px;
-}
-
-.report-card .report-message {
- list-style-type: none;
-}
-
-/* Search Result */
-
-.result-items .result-item:last-of-type {
- margin-bottom: 50px;
-}
-
-.result-item {
- list-style: none;
- margin-bottom: 30px;
-}
-
-
-.result-item .result-info {
- margin-left: 20px;
- float: left;
-}
-
-.result-item img.result-book-cover {
- float: left;
- object-fit: contain;
- height: 150px;
- width: 100px;
-}
-
-.result-item .result-info .rating-empty {
- font-size: small;
-}
-
-.result-item .result-info .rating-star{
- cursor: unset;
- display: inline;
- position: relative;
- top: 3px;
- left: -3px;
-}
-
-.result-item .result-info .result-book-info {
- font-size: 80%;
- overflow: hidden;
- width: 420px;
- display: inline-block;
- white-space: nowrap;
- text-overflow: ellipsis;
- position: relative;
- top: .55rem;
-}
-
-.result-item .result-info .rating-score {
- font-size: 80%;
- display: inline;
- margin-right: 20px;
-}
-
-.result-item .result-info .result-item-title {
- white-space: nowrap;
- text-overflow: ellipsis;
- max-width: 500px;
- display: block;
- overflow: hidden
-}
-
-.result-item .result-info .result-item-brief {
- margin-top: 10px;
- margin-bottom: 0;
- font-size: small;
- width: 565px;
- display: block;
- text-overflow: ellipsis;
- overflow: hidden;
- /* white-space: nowrap; */
- height: 90px;
-}
-
-.aside-card .add-nav .clearfix {
- margin-bottom: 5px;
-}
-
-/* Pagination */
-.pagination {
- position: absolute;
- bottom: 30px;
- left: 50%;
- transform: translateX(-50%);
- text-align: center;
-}
-
-.pagination a {
- display: inline-block;
-}
-
-.pagination .button {
- padding: 0 5px;
- height: 2rem;
-}
-
-.pagination .page-index {
- font-size: small;
-}
-
-/* Display Page */
-
-img.display-image {
- height: 210px;
- object-fit: contain;
- float: left;
- max-width: 200px;
-}
-
-.display-info {
- max-width: 530px;
- float: left;
- margin-left: 20px;
-
- overflow: hidden;
- text-overflow: ellipsis;
-}
-
-.display-title {
- display: -webkit-box;
- -webkit-line-clamp: 1; /* number of lines to show */
- -webkit-box-orient: vertical;
- font-weight: bold;
-}
-
-.display-info-detail {
- font-size: small;
- width: 250px;
- display: inline-block;
- vertical-align: top;
-}
-
-.display-info-detail .rating-star {
- position: relative;
- left: -5px;
-}
-
-.display-info-detail .rating-score {
- position: relative;
- top: -2.5px;
- font-weight: bold;
-}
-
-.display-info-detail form, .display-info-detail input[type='submit'] {
- display: inline;
-}
-
-.mark {
- font-size: small;
- margin-bottom: 5px;
-}
-
-.mark form {
- display: inline;
- /* margin: 0; */
-}
-
-.mark .mark-status-label {
- font-weight: bold;
-}
-
-.mark .rating-star {
- position: relative;
- top: 1.5px;
-}
-
-.mark .icon-lock {
- position: relative;
- top: -0.5px;
-}
-
-.mark .clearfix {
- margin-bottom: 5px;
-}
-
-.list-item .item-time {
- color: var(--light);
- margin-left: 5px;
- font-size: small;
-}
-
-.list-item .mark-text {
- margin: 20px 0 15px 0;
-}
-
-
-.mark .button-group a.button{
- width: 33%;
- box-sizing: border-box;
- display: initial;
- padding: 7px 8%;
- margin: 0 4px;
- font-weight: normal;
-}
-
-.review {
- font-size: small;
- margin-bottom: 5px;
-}
-
-.review .clearfix {
- margin-bottom: 5px;
-}
-
-.review .review-label {
- font-weight: bold;
-}
-
-.review .review-time {
- color: var(--light);
-}
-
-.review .review-title {
- font-size: small;
- font-weight: bold;
- display: block;
- margin-top: 10px;
- margin-bottom: 5px;
-}
-
-.review .review-head .edit {
- margin-left: 10px;
-}
-
-.set .mark {
- font-size: small;
- /* margin-bottom: 3px; */
- padding-left: 20px;
- padding-right: 20px;
-}
-
-.list-label .rating-star {
- position: relative;
- top: 3px;
-}
-
-.list-label .list-owner-name {
- position: relative;
- top: -1px;
-}
-
-.list-label {
- font-size: small;
-}
-
-.set .mark-text {
- margin: 0;
-}
-
-.set .review-title {
- font-weight: bold;
- font-size: small;
-}
-
-.set.result-items .list-item {
- margin-bottom: 10px;
-}s
-
-.aside-card .aside-item {
- overflow: hidden;
-}
-
-.aside-item .item-image {
- height: 150px;
-}
-
-.aside-item div {
- font-size: small;
-}
-
-.aside-item .item-title {
- font-weight: bold;
- font-size: small;
- margin-bottom: 5px;
- margin-top: 10px;
-}
-
-.aside-item .rating-star {
- position: relative;
- top: 4px;
-}
-
-.list-head {
- margin-bottom: 30px;
-}
-
-.user {
- font-size: small;
- margin-bottom: 24px;
-}
-
-.user .user-info {
- margin-left: 15px;
- max-width: 88%;
-}
-
-.user .user-name {
- font-size: small;
- margin-bottom: 5px;
-}
-
-.user .user-brief {
- margin: 0;
-}
-
-.user .avatar {
- height: 70px;
-}
-
-iframe {
- width: 100%;
- height: 500px;
-}
\ No newline at end of file
diff --git a/common/static/css/boofilsic_edit.css b/common/static/css/boofilsic_edit.css
deleted file mode 100644
index 7a664209..00000000
--- a/common/static/css/boofilsic_edit.css
+++ /dev/null
@@ -1,361 +0,0 @@
-/* Global */
-
-:root {
- --primary: #00a1cc;
- --secondary: #606c76;
- --light: #ccc;
- --bright: rgb(247, 247, 247);
-}
-
-html {
- /* background-color: #eee; */
- font-size: 55%;
- height: 100%;
-}
-
-body {
- height: 100%;
- margin: 0;
-}
-
-.rating-star {
- cursor: unset;
-}
-
-.rating-star .jq-star {
- cursor: unset;
-}
-
-.icon-lock svg{
- fill: var(--light);
- height: 12px;
- position: relative;
- top: 1px;
- margin-left: 3px;
-}
-
-.errorlist {
- color: var(--primary);
- font-size: small;
- font-weight: bold;
- list-style-type: square;
-}
-
-#page-wrapper {
- position: relative;
- min-height: 100vh;
- z-index: 0;
-}
-
-#content-wrapper {
- padding-bottom: 160px;
-}
-
-
-input[type=text]::-ms-clear { display: none; width : 0; height: 0; }
-input[type=text]::-ms-reveal { display: none; width : 0; height: 0; }
-input[type="search"]::-webkit-search-decoration,
-input[type="search"]::-webkit-search-cancel-button,
-input[type="search"]::-webkit-search-results-button,
-input[type="search"]::-webkit-search-results-decoration { display: none; }
-
-footer {
- text-align: center;
-
- margin-bottom: 4px !important;
-
- border-top: var(--bright) solid 2px;
-
- position: absolute !important;
- left: 50%;
- transform: translateX(-50%);
- bottom: 0;
-}
-
-footer a {
- margin: 0 15px;
- font-size: small;
-}
-
-textarea {
- resize: vertical;
- height: 180px;
-}
-
-img.emoji {
- height: 20px !important;
- width: 20px !important;
- box-sizing: border-box;
- object-fit: contain;
- position: relative;
- top: 3px;
-}
-
-.more-link {
- font-size: small;
- margin-left: 5px;
-}
-
-div.dividing-line {
- height: 0;
- width: 100%;
- margin: 40px 0 15px 0;
- border-top: solid 1px var(--light);
-}
-
-/* Nav Bar */
-
-section#navbar {
- background-color: var(--bright);
- box-sizing: border-box;
- padding: 18px 0;
- margin-bottom: 50px;
- border-bottom: var(--light) 0.5px solid;
-
-}
-
-.navbar img.logo {
- width: 100px;
- float: left;
-}
-
-.navbar h4.nav-title {
- display: inline;
- margin-left: 16px;
- position: relative;
- top: 7px;
-}
-
-.navbar a.nav-link, .navbar a.nav-link:visited {
-
- float: right;
- margin-top: 10px;
- color: var(--secondary);
- margin-left: 20px;
-}
-
-.navbar a.nav-link:hover, .navbar a.nav-link:hover:visited {
- color: var(--primary);
-}
-
-textarea::placeholder {
- color: var(--light);
-}
-
-/* Main Content Section */
-
-section#content div#main {
- padding: 32px 35px;
- background-color: var(--bright);
- width: 100%;
-}
-
-div#main form label {
- font-size: small;
- font-weight: normal;
-}
-
-div#main form input::placeholder {
- color: var(--light);
-}
-
-div#main form button[type="submit"] {
- margin-top: 20px;
-}
-
-div#main form input[type="file"] {
- display: block;
- margin-bottom: 0;
-}
-
- /* Info Card */
-
-.aside-card {
- background-color: var(--bright);
- padding: 20px 24px 15px 24px;
- margin-bottom: 30px;
-}
-
-.aside-card .clearfix {
- margin-bottom: 15px;
-}
-
-.aside-card .info-avatar {
- width: 72px;
- object-fit: contain;
- float: left;
-}
-
-.aside-card .info-name {
- margin: 0;
- max-width: 120px;
- margin-bottom: 12px;
- padding-left: 8px;
- float: left;
-}
-
-.aside-card .info-brief {
- line-height: 2rem;
- font-size: small;
- overflow-wrap: break-word;
- hyphens: auto;
-}
-
-.aside-card a.report {
- color: var(--light);
- font-size: small;
-}
-
-.aside-card a.follow {
- font-size: small;
- color: var(--secondary);
- margin-right: 10px;
-}
-
-.aside-card .button.add-button {
- margin-top: 10px;
-}
-
-/* Relation Card */
-
-.relation-card {
- padding: 2px;
- margin-bottom: 10px;
-}
-
-.relation-card .relation-label {
- margin: 0;
- margin-bottom: 12px;
- display: inline-block;
-}
-
-.relation-card .relation-user .relation-avatar {
- width: 50px;
-}
-
-.relation-card .relation-user .relation-name {
- display: block;
- font-size: small;
- line-height: 1.8rem;
- /* white-space: nowrap; */
- text-overflow: ellipsis;
- /* max-width: 100px; */
- overflow: hidden;
-}
-
-.relation-card .relation-user-list {
- margin-bottom: 15px;
-}
-
-.relation-card .relation-user-list .relation-user {
- list-style-type: none;
- text-align: center;
- margin-bottom: 0px !important;
- justify-items: center;
- padding: 0 3px !important;
-}
-
-/* Report Card */
-
-.report-card {
- padding: 2px;
- font-size: small;
-}
-
-.report-card .report-label {
- margin: 0;
-}
-
-.report-card .report-user-link {
- padding: 0 5px;
-}
-
-.report-card .report-message {
- list-style-type: none;
-}
-
-.item-card img.item-image {
- height: 150px;
- display: inline-block;
-}
-
-.item-card .item-info {
- display: inline-block;
- margin-left: 20px;
-}
-
-.item-card .item-info .item-title {
- font-weight: bold;
-}
-
-.item-card .item-info .rating-star {
- display: inline;
- position: relative;
- top: 3px;
- left: -2px;
-}
-
-.prompt {
- font-weight: bold;
- margin-bottom: 40px;
-}
-
-.review .option .selection ul {
- list-style-type: none;
- display: inline;
-}
-
-.review .option .selection ul li, .review .option .selection ul label {
- display: inline;
-}
-
-.review .option .selection ul li {
- position: relative;
- top: 1px;
-}
-
-.review .option input[type="checkbox"], .review .option input[type="radio"] {
- position: relative;
- top: 2px;
-}
-
-.review input[type="submit"] {
- margin-top: 16px;
-}
-
-.review textarea {
- height: 400px;
- margin: 0;
-}
-
-.review .preview-button {
- font-size: small;
- font-weight: bold;
- color: var(--primary);
- cursor: pointer;
-}
-
-.review .markdownx-preview {
- display: none;
- min-height: 400px;
- overflow: auto;
- border-top: 0.1rem solid #d1d1d1;
- border-bottom: 0.1rem solid #d1d1d1;
- padding: 10px;
- margin: 20px 0;
-}
-
-.review .fyi {
- margin-bottom: 15px;
- color: var(--light);
-}
-
-.review {
- margin-top: 30px;
-}
-
-.review .delete-preview .markdownx-preview {
- padding-left: 0;
- padding-right: 0;
- margin: 20px 0;
-}
\ No newline at end of file
diff --git a/common/static/js/home.js b/common/static/js/home.js
deleted file mode 100644
index e1eed707..00000000
--- a/common/static/js/home.js
+++ /dev/null
@@ -1,129 +0,0 @@
-$(document).ready( function() {
- $("#userInfoCard .mast-brief").text($("
"+$("#userInfoCard .mast-brief").text().replace(/\
").text());
- $("#userInfoCard .mast-brief").html($("#userInfoCard .mast-brief").html().replace(/\n/g,'
'));
-
- let token = $("#oauth2Token").text();
- let mast_domain = $("#mastodonURI").text();
- let mast_uri = 'https://' + mast_domain
- let id = $("#userMastodonID").text();
-
- if (id && id != 'None' && mast_domain != 'twitter.com') {
- // let userInfoSpinner = $("#spinner").clone().removeAttr("hidden");
- let followersSpinner = $("#spinner").clone().removeAttr("hidden");
- let followingSpinner = $("#spinner").clone().removeAttr("hidden");
- // $("#userInfoCard").append(userInfoSpinner);
- $("#followings h5").after(followingSpinner);
- $("#followers h5").after(followersSpinner);
- $(".mast-following-more").hide();
- $(".mast-followers-more").hide();
-
- getUserInfo(
- id,
- mast_uri,
- token,
- function(userData) {
- let userName;
- if (userData.display_name) {
- userName = translateEmojis(userData.display_name, userData.emojis, true);
- } else {
- userName = userData.username;
- }
- $("#userInfoCard .mast-displayname").html(userName);
- }
- );
-
- getFollowers(
- id,
- mast_uri,
- token,
- function(userList, request) {
- if (userList.length == 0) {
- $(".mast-followers").hide();
- $(".mast-followers").before('
暂无
');
-
- } else {
- if (userList.length > 4){
- userList = userList.slice(0, 4);
- $(".mast-followers-more").show();
- }
- let template = $(".mast-followers li").clone();
- $(".mast-followers").html("");
- userList.forEach(data => {
- temp = $(template).clone();
- temp.find("img").attr("src", data.avatar);
- if (data.display_name) {
- temp.find(".mast-displayname").html(translateEmojis(data.display_name, data.emojis));
- } else {
- temp.find(".mast-displayname").text(data.username);
- }
- let url;
- if (data.acct.includes('@')) {
- url = $("#userPageURL").text().replace('0', data.acct);
- } else {
- url = $("#userPageURL").text().replace('0', data.acct + '@' + mast_domain);
- }
- temp.find("a").attr('href', url);
- $(".mast-followers").append(temp);
- });
- }
- $(followersSpinner).remove();
- }
- );
-
- getFollowing(
- id,
- mast_uri,
- token,
- function(userList, request) {
- if (userList.length == 0) {
- $(".mast-following").hide();
- $(".mast-following").before('
暂无
');
- } else {
- if (userList.length > 4){
- userList = userList.slice(0, 4);
- $(".mast-following-more").show();
- }
- let template = $(".mast-following li").clone();
- $(".mast-following").html("");
- userList.forEach(data => {
- temp = $(template).clone()
- temp.find("img").attr("src", data.avatar);
- if (data.display_name) {
- temp.find(".mast-displayname").html(translateEmojis(data.display_name, data.emojis));
- } else {
- temp.find(".mast-displayname").text(data.username);
- }
- let url;
- if (data.acct.includes('@')) {
- url = $("#userPageURL").text().replace('0', data.acct);
- } else {
- url = $("#userPageURL").text().replace('0', data.acct + '@' + mast_domain);
- }
- temp.find("a").attr('href', url);
- $(".mast-following").append(temp);
- });
- }
- $(followingSpinner).remove();
-
- }
- );
- }
-
- // mobile dropdown
- $(".relation-dropdown__button").data("collapse", true);
- function onClickDropdownButton(e) {
- const button = $(".relation-dropdown__button");
- button.data("collapse", !button.data("collapse"));
- button.children('.icon-arrow').toggleClass("icon-arrow--expand");
- $('.relation-dropdown__body').toggleClass("relation-dropdown__body--expand");
- }
- $(".relation-dropdown__button").on('click', onClickDropdownButton);
-
- // close when click outside
- window.onclick = evt => {
- const target = $(evt.target);
- if (!target.parents('.relation-dropdown').length && !$(".relation-dropdown__button").data("collapse")) {
- onClickDropdownButton();
- }
- };
-});
diff --git a/common/static/js/key_value_input.js b/common/static/js/key_value_input.js
deleted file mode 100644
index 8b15b1b0..00000000
--- a/common/static/js/key_value_input.js
+++ /dev/null
@@ -1,81 +0,0 @@
-function keyValueInput(valueKeyWidget, hiddenInput) {
- let placeholderKey = valueKeyWidget.attr('placeholder-key');
- let placeholderValue = valueKeyWidget.attr('placeholder-value');
- if (placeholderKey == null) {
- placeholderKey = '';
- }
-
- if (placeholderValue == null) {
- placeholderValue = '';
- }
- // assign existing pairs to hidden input
- setHiddenInput(valueKeyWidget);
-
- let newInputPair = $('
');
- valueKeyWidget.append(newInputPair.clone());
- // add new input pair
- valueKeyWidget.on('input', ':nth-last-child(1)', function () {
- if ($(this).val() && $(this).prev().val()) {
- valueKeyWidget.append($(newInputPair).clone());
- }
- });
- valueKeyWidget.on('input', ':nth-last-child(2)', function () {
- if ($(this).val() && $(this).next().val()) {
- valueKeyWidget.append($(newInputPair).clone());
- }
- });
- valueKeyWidget.on('input', ':nth-last-child(4)', function () {
- if (!$(this).val() && !$(this).next().val() && valueKeyWidget.children("input").length > 2) {
- $(this).next().remove();
- $(this).remove();
- }
- });
-
- valueKeyWidget.on('input', ':nth-last-child(3)', function () {
- if (!$(this).val() && !$(this).prev().val() && valueKeyWidget.children("input").length > 2) {
- $(this).prev().remove();
- $(this).remove();
- }
- });
-
- valueKeyWidget.on('input', function () {
- setHiddenInput(this);
- });
-
- function setHiddenInput(elem) {
- let keys = $(elem).children(":nth-child(odd)").map(function () {
- if ($(this).val()) {
- return $(this).val();
- }
- }).get();
- let values = $(elem).children(":nth-child(even)").map(function () {
- if ($(this).val()) {
- return $(this).val();
- }
- }).get();
- if (keys.length == values.length) {
- let finalValue = [];
- keys.forEach(function (key, i) {
- let json = new Object;
- json[key] = values[i];
- finalValue.push(JSON.stringify(json))
- });
- hiddenInput.val(finalValue.toString());
- } else if (keys.length - values.length == 1) {
- let finalValue = [];
- keys.forEach(function (key, i) {
- let json = new Object;
- if (i < keys.length - 1) {
- json[key] = values[i];
- } else {
- json[key] = ''
- }
- finalValue.push(JSON.stringify(json))
- });
- hiddenInput.val(finalValue.toString());
- }
- }
-
-
-}
-
diff --git a/common/static/js/mastodon.js b/common/static/js/mastodon.js
deleted file mode 100644
index ce1d8a58..00000000
--- a/common/static/js/mastodon.js
+++ /dev/null
@@ -1,140 +0,0 @@
-// .replace(":id", "")
-
-// GET
-const API_FOLLOWERS = "/api/v1/accounts/:id/followers"
-// GET
-const API_FOLLOWING = "/api/v1/accounts/:id/following"
-// GET
-const API_GET_ACCOUNT = '/api/v1/accounts/:id'
-
-const NUMBER_PER_REQUEST = 20
-
-
-// [
-// {
-// "id": "1020382",
-// "username": "atul13061987",
-// "acct": "atul13061987",
-// "display_name": "",
-// "locked": false,
-// "bot": false,
-// "created_at": "2019-12-04T07:17:02.745Z",
-// "note": "
",
-// "url": "https://mastodon.social/@atul13061987",
-// "avatar": "https://mastodon.social/avatars/original/missing.png",
-// "avatar_static": "https://mastodon.social/avatars/original/missing.png",
-// "header": "https://mastodon.social/headers/original/missing.png",
-// "header_static": "https://mastodon.social/headers/original/missing.png",
-// "followers_count": 0,
-// "following_count": 2,
-// "statuses_count": 0,
-// "last_status_at": null,
-// "emojis": [],
-// "fields": []
-// },
-// {
-// "id": "1020381",
-// "username": "linuxliner",
-// "acct": "linuxliner",
-// "display_name": "",
-// "locked": false,
-// "bot": false,
-// "created_at": "2019-12-04T07:15:56.426Z",
-// "note": "
",
-// "url": "https://mastodon.social/@linuxliner",
-// "avatar": "https://mastodon.social/avatars/original/missing.png",
-// "avatar_static": "https://mastodon.social/avatars/original/missing.png",
-// "header": "https://mastodon.social/headers/original/missing.png",
-// "header_static": "https://mastodon.social/headers/original/missing.png",
-// "followers_count": 0,
-// "following_count": 2,
-// "statuses_count": 0,
-// "last_status_at": null,
-// "emojis": [],
-// "fields": []
-// }
-// ]
-async function getFollowers(id, mastodonURI, token, callback) {
- const url = mastodonURI + API_FOLLOWERS.replace(":id", id);
- var response;
- try {
- response = await fetch(url+'?limit='+NUMBER_PER_REQUEST, {headers: {'Authorization': 'Bearer ' + token}});
- } catch (e) {
- console.error('loading followers failed.');
- return;
- }
- const json = await response.json();
- let nextUrl = null;
- let links = response.headers.get('link');
- if (links) {
- links.split(',').forEach(link => {
- if (link.includes('next')) {
- let regex = /<(.*?)>/;
- nextUrl = link.match(regex)[1];
- }
- });
- }
- callback(json, nextUrl);
-}
-
-async function getFollowing(id, mastodonURI, token, callback) {
- const url = mastodonURI + API_FOLLOWING.replace(":id", id);
- var response;
- try {
- response = await fetch(url+'?limit='+NUMBER_PER_REQUEST, {headers: {'Authorization': 'Bearer ' + token}});
- } catch (e) {
- console.error('loading following failed.');
- return;
- }
- const json = await response.json();
- let nextUrl = null;
- let links = response.headers.get('link');
- if (links) {
- links.split(',').forEach(link => {
- if (link.includes('next')) {
- let regex = /<(.*?)>/;
- nextUrl = link.match(regex)[1];
- }
- });
- }
- callback(json, nextUrl);
-}
-
-function getUserInfo(id, mastodonURI, token, callback) {
- let url = mastodonURI + API_GET_ACCOUNT.replace(":id", id);
- fetch(url, {headers: {'Authorization': 'Bearer ' + token}}).then((response) => response.json()).then(callback);
- // $.ajax({
- // url: url,
- // method: 'GET',
- // headers: {
- // 'Authorization': 'Bearer ' + token,
- // },
- // success: function(data){
- // callback(data);
- // },
- // });
-}
-
-function getEmojiDict(emoji_list) {
- let dict = new Object;
- emoji_list.forEach(pair => {
- dict[":" + pair.shortcode + ":"] = pair.url;
- });
- return dict;
-}
-
-function translateEmojis(text, emoji_list, large) {
- let dict = getEmojiDict(emoji_list);
- let regex = /:(.*?):/g;
- let translation = null
- if (large) {
- translation = text.replace(regex, function (match) {
- return "

";
- });
- } else {
- translation = text.replace(regex, function (match) {
- return "

";
- });
- }
- return translation;
-}
diff --git a/common/static/lib/css/collection.css b/common/static/lib/css/collection.css
deleted file mode 100644
index 12addddb..00000000
--- a/common/static/lib/css/collection.css
+++ /dev/null
@@ -1,271 +0,0 @@
-.action-bar {
- float: right;
- color: #ccc;
-}
-
-.action-bar.inline {
- float: unset;
- display: inline;
-}
-
-.action-bar a {
- cursor: pointer;
- color: #ccc;
-}
-
-.action-bar>span {
- margin-left: 8px;
-}
-
-.action-bar a:hover {
- color: #00a1cc;
-}
-
-.action-icon svg {
- cursor: pointer;
- fill: #ccc;
- height: 12px;
- vertical-align: text-bottom;
-}
-
-.entity-list__entity-img-wrapper {
- position: relative;
-}
-
-.entity-list__entity-action-icon {
- position: absolute;
- top:0;
- right:0;
- mix-blend-mode: hard-light;
- text-stroke: 1px black;
- background-color: lightgray;
- border-radius: 0 0 0 8px;
- padding: 0 4px;
- cursor: pointer;
- opacity: 0.2;
-}
-
-.entity-list__entity-action-icon:hover {
- opacity: 1;
-}
-
-.helptext{
- position: relative;
- top: -1em;
-}
-/*** django-jsoneditor ***/
-div.jsoneditor {
- border-color: #ccc !important;;
-}
-div.jsoneditor-menu {
- background-color: #606c76 !important;;
- border-color: #606c76 !important;
-}
-
-/***** MODAL DIALOG ****/
-#modal {
- /* Underlay covers entire screen. */
- position: fixed;
- top:0px;
- bottom: 0px;
- left:0px;
- right:0px;
- background-color:rgba(0,0,0,0.5);
- z-index:1000;
-
- /* Flexbox centers the .modal-content vertically and horizontally */
- display:flex;
- flex-direction:column;
- align-items:center;
-
- /* Animate when opening */
- animation-name: fadeIn;
- animation-duration:150ms;
- animation-timing-function: ease;
-}
-
-#modal > .modal-underlay {
- /* underlay takes up the entire viewport. This is only
- required if you want to click to dismiss the popup */
- position: absolute;
- z-index: -1;
- .collection_list_position_edittop:0px;
-
-
- bottom:0px;
- left: 0px;
- right: 0px;
-}
-
-#modal > .modal-content {
- /* Position visible dialog near the top of the window */
- margin-top:10vh;
-
- /* Sizing for visible dialog */
- width:80%;
- max-width:600px;
-
- /* Display properties for visible dialog*/
- background-color: #f7f7f7;
- padding: 20px 20px 10px 20px;
- color: #606c76;
-
- /* Animate when opening */
- animation-name:zoomIn;
- animation-duration:150ms;
- animation-timing-function: ease;
-}
-
-#modal.closing {
- /* Animate when closing */
- animation-name: fadeOut;
- animation-duration:150ms;
- animation-timing-function: ease;
-}
-
-#modal.closing > .modal-content {
- /* Aniate when closing */
- animation-name: zoomOut;
- animation-duration:150ms;
- animation-timing-function: ease;
-}
-
-@keyframes fadeIn {
- 0% {opacity: 0;}
- 100% {opacity: 1;}
-}
-
-@keyframes fadeOut {
- 0% {opacity: 1;}
- 100% {opacity: 0;}
-}
-
-@keyframes zoomIn {
- 0% {transform: scale(0.9);}
- 100% {transform: scale(1);}
-}
-
-@keyframes zoomOut {
- 0% {transform: scale(1);}
- 100% {transform: scale(0.9);}
-}
-
-#modal .add-to-list-modal__head {
- margin-bottom: 20px;
-}
-
-#modal .add-to-list-modal__head::after {
- content: ' ';
- clear: both;
- display: table;
-}
-
-#modal .add-to-list-modal__title {
- font-weight: bold;
- font-size: 1.2em;
- float: left;
-}
-
-#modal .add-to-list-modal__close-button {
- float: right;
- cursor: pointer;
-}
-
-#modal .add-to-list-modal__confirm-button {
- float: right;
-}
-
-#modal li, #modal ul, #modal label {
- display: inline;
-}
-
-.donut {
- margin-left: 10%;
- width: 80%;
- aspect-ratio : 1 / 1;
- border-radius: 50%;
- display: flex;
- align-items: center;
- justify-content: center;
-}
-.donut .hole {
- width: 80%;
- aspect-ratio : 1 / 1;
- border-radius: 50%;
- background: #f7f7f7;
- display: flex;
- align-items: center;
- justify-content: center;
-}
-
-/* progress {
- border-radius: 7px;
- width: 80%;
- height: 10px;
- box-shadow: 1px 1px 4px rgba( 0, 0, 0, 0.2 );
-}
-::-webkit-progress-bar {
- background-color: #ccc;
-}
-::-webkit-progress-value {
- background-color: #00a1cc;
-} */
-
-.markdownx-editor {
- font-family: monospace;
-}
-
-.icon {
- color: grey;
- cursor: pointer;
-}
-.icon:hover {
- color: #00a1cc;
-}
-
-input:invalid#position {
- border: red dashed 1px;
-}
-
-summary:focus {
- outline-style: none;
-}
-summary::-webkit-details-marker {
- display: none;
-}
-
-.gg-play-button-o {
- box-sizing: border-box;
- position: relative;
- display: inline-block;
- transform: scale(var(--ggs,1));
- width: 22px;
- height: 22px;
- border: 2px solid;
- border-radius: 20px
-}
-.gg-play-button-o::before {
- content: "";
- display: inline-block;
- box-sizing: border-box;
- position: absolute;
- width: 0;
- height: 10px;
- border-top: 5px solid transparent;
- border-bottom: 5px solid transparent;
- border-left: 6px solid;
- top: 4px;
- left: 7px
-}
-
-
-.icon-spin {
- transition: transform .8s ease-in-out;
-}
-.icon-spin:hover {
- transform: rotate(360deg);
-}
-
-.action-bar .fa-lock, .fa-spin {
- color: lightgray;
-}
diff --git a/common/static/lib/css/rating-star.css b/common/static/lib/css/rating-star.css
deleted file mode 100644
index 0fd1fcbe..00000000
--- a/common/static/lib/css/rating-star.css
+++ /dev/null
@@ -1,38 +0,0 @@
-.jq-stars {
- display: inline-block;
-}
-
-.jq-rating-label {
- font-size: 22px;
- display: inline-block;
- position: relative;
- vertical-align: top;
- font-family: helvetica, arial, verdana;
-}
-
-.jq-star {
- width: 100px;
- height: 100px;
- display: inline-block;
- cursor: pointer;
-}
-
-.jq-star-svg {
- padding-left: 3px;
- width: 100%;
- height: 100% ;
-}
-
-.jq-star:hover .fs-star-svg path {
-}
-
-.jq-star-svg path {
- /* stroke: #000; */
- stroke-linejoin: round;
-}
-
-/* un-used */
-.jq-shadow {
- -webkit-filter: drop-shadow( -2px -2px 2px #888 );
- filter: drop-shadow( -2px -2px 2px #888 );
-}
diff --git a/common/static/lib/css/tag-input.css b/common/static/lib/css/tag-input.css
deleted file mode 100644
index edfc7b71..00000000
--- a/common/static/lib/css/tag-input.css
+++ /dev/null
@@ -1,64 +0,0 @@
-@charset "UTF-8";
-.tag-input {
- display: -webkit-box;
- display: -ms-flexbox;
- display: flex;
- -webkit-box-pack: start;
- -ms-flex-pack: start;
- justify-content: flex-start;
- -ms-flex-wrap: wrap;
- flex-wrap: wrap;
- border-bottom: 0.1rem solid #ccc;
- padding-bottom: 2px;
-
-}
-
-.tag-input__tag {
- position: relative;
- display: block;
- float: left;
- color: white;
- background: #d5d5d5;
- padding: 5px 20px 5px 6px;
- margin: 4px;
- border-radius: .4rem;
- line-height: 1em;
- -webkit-transition: all 0.2s ease-in-out;
- transition: all 0.2s ease-in-out;
-}
-
-.tag-input__tag.tag-input__tag--highlight {
- color: white;
- background: #00a1cc;
-}
-
-.tag-input__close {
- position: absolute;
- top: 0;
- right: 0;
- width: 14px;
- height: 100%;
- cursor: pointer;
- border-radius: 0 2px 2px 0;
- -webkit-transition: background 0.2s;
- transition: background 0.2s;
-}
-
-.tag-input__close:after {
- position: absolute;
- content: "×";
- top: 5px;
- left: 2px;
-}
-
-.tag-input__close:hover {
- color: #606c76;
-}
-
-.tag-input input {
- border: 0;
- margin: 4px;
- padding: 3px 7px 3px 0;
- width: auto;
- outline: none;
-}
diff --git a/common/static/lib/js/hyperscript-0.9.7.min.js b/common/static/lib/js/hyperscript-0.9.7.min.js
deleted file mode 100644
index 4e22b3b8..00000000
--- a/common/static/lib/js/hyperscript-0.9.7.min.js
+++ /dev/null
@@ -1 +0,0 @@
-(function(e,t){const r=t(e);if(typeof exports==="object"&&typeof exports["nodeName"]!=="string"){module.exports=r}else{e["_hyperscript"]=r;if("document"in e)e["_hyperscript"].browserInit()}})(typeof self!=="undefined"?self:this,(e=>{"use strict";const t={dynamicResolvers:[function(e,t){if(e==="Fixed"){return Number(t).toFixed()}else if(e.indexOf("Fixed:")===0){let r=e.split(":")[1];return Number(t).toFixed(parseInt(r))}}],String:function(e){if(e.toString){return e.toString()}else{return""+e}},Int:function(e){return parseInt(e)},Float:function(e){return parseFloat(e)},Number:function(e){return Number(e)},Date:function(e){return new Date(e)},Array:function(e){return Array.from(e)},JSON:function(e){return JSON.stringify(e)},Object:function(e){if(e instanceof String){e=e.toString()}if(typeof e==="string"){return JSON.parse(e)}else{return Object.assign({},e)}}};const r={attributes:"_, script, data-script",defaultTransition:"all 500ms ease-in",disableSelector:"[disable-scripting], [data-disable-scripting]",conversions:t};class n{static OP_TABLE={"+":"PLUS","-":"MINUS","*":"MULTIPLY","/":"DIVIDE",".":"PERIOD","..":"ELLIPSIS","\\":"BACKSLASH",":":"COLON","%":"PERCENT","|":"PIPE","!":"EXCLAMATION","?":"QUESTION","#":"POUND","&":"AMPERSAND",$:"DOLLAR",";":"SEMI",",":"COMMA","(":"L_PAREN",")":"R_PAREN","<":"L_ANG",">":"R_ANG","<=":"LTE_ANG",">=":"GTE_ANG","==":"EQ","===":"EQQ","!=":"NEQ","!==":"NEQQ","{":"L_BRACE","}":"R_BRACE","[":"L_BRACKET","]":"R_BRACKET","=":"EQUALS"};static isValidCSSClassChar(e){return n.isAlpha(e)||n.isNumeric(e)||e==="-"||e==="_"||e===":"}static isValidCSSIDChar(e){return n.isAlpha(e)||n.isNumeric(e)||e==="-"||e==="_"||e===":"}static isWhitespace(e){return e===" "||e==="\t"||n.isNewline(e)}static positionString(e){return"[Line: "+e.line+", Column: "+e.column+"]"}static isNewline(e){return e==="\r"||e==="\n"}static isNumeric(e){return e>="0"&&e<="9"}static isAlpha(e){return e>="a"&&e<="z"||e>="A"&&e<="Z"}static isIdentifierChar(e,t){return e==="_"||e==="$"}static isReservedChar(e){return e==="`"||e==="^"}static isValidSingleQuoteStringStart(e){if(e.length>0){var t=e[e.length-1];if(t.type==="IDENTIFIER"||t.type==="CLASS_REF"||t.type==="ID_REF"){return false}if(t.op&&(t.value===">"||t.value===")")){return false}}return true}static tokenize(e,t){var r=[];var a=e;var o=0;var s=0;var u=1;var l="
";var c=0;function f(){return t&&c===0}while(o=0){return this.consumeToken()}}requireToken(e,t){var r=this.matchToken(e,t);if(r){return r}else{this.raiseError(this,"Expected '"+e+"' but found '"+this.currentToken().value+"'")}}peekToken(e,t,r){return this.tokens[t]&&this.tokens[t].value===e&&this.tokens[t].type===r}matchToken(e,t){if(this.follows.indexOf(e)!==-1){return}t=t||"IDENTIFIER";if(this.currentToken()&&this.currentToken().value===e&&this.currentToken().type===t){return this.consumeToken()}}consumeToken(){var e=this.tokens.shift();this.consumed.push(e);this._lastConsumed=e;this.consumeWhitespace();return e}consumeUntil(e,t){var r=[];var n=this.token(0,true);while((t==null||n.type!==t)&&(e==null||n.value!==e)&&n.type!=="EOF"){var i=this.tokens.shift();this.consumed.push(i);r.push(n);n=this.token(0,true)}this.consumeWhitespace();return r}lastWhitespace(){if(this.consumed[this.consumed.length-1]&&this.consumed[this.consumed.length-1].type==="WHITESPACE"){return this.consumed[this.consumed.length-1].value}else{return""}}consumeUntilWhitespace(){return this.consumeUntil(null,"WHITESPACE")}hasMore(){return this.tokens.length>0}token(e,t){var r;var n=0;do{if(!t){while(this.tokens[n]&&this.tokens[n].type==="WHITESPACE"){n++}}r=this.tokens[n];e--;n++}while(e>-1);if(r){return r}else{return{type:"EOF",value:"<<>>"}}}currentToken(){return this.token(0)}lastMatch(){return this._lastConsumed}static sourceFor=function(){return this.programSource.substring(this.startToken.start,this.endToken.end)};static lineFor=function(){return this.programSource.split("\n")[this.startToken.line-1]};follows=[];pushFollow(e){this.follows.push(e)}popFollow(){this.follows.pop()}clearFollows(){var e=this.follows;this.follows=[];return e}restoreFollows(e){this.follows=e}}class a{constructor(e){this.runtime=e;this.possessivesDisabled=false;this.addGrammarElement("feature",(function(e,t,r){if(r.matchOpToken("(")){var n=e.requireElement("feature",r);r.requireOpToken(")");return n}var i=e.FEATURES[r.currentToken().value||""];if(i){return i(e,t,r)}}));this.addGrammarElement("command",(function(e,t,r){if(r.matchOpToken("(")){const t=e.requireElement("command",r);r.requireOpToken(")");return t}var n=e.COMMANDS[r.currentToken().value||""];let i;if(n){i=n(e,t,r)}else if(r.currentToken().type==="IDENTIFIER"){i=e.parseElement("pseudoCommand",r)}if(i){return e.parseElement("indirectStatement",r,i)}return i}));this.addGrammarElement("commandList",(function(e,t,r){var n=e.parseElement("command",r);if(n){r.matchToken("then");const t=e.parseElement("commandList",r);if(t)n.next=t;return n}}));this.addGrammarElement("leaf",(function(e,t,r){var n=e.parseAnyOf(e.LEAF_EXPRESSIONS,r);if(n==null){return e.parseElement("symbol",r)}return n}));this.addGrammarElement("indirectExpression",(function(e,t,r,n){for(var i=0;i{this.unifiedExec(e,t)})).catch((e=>{this.unifiedExec({op:function(){throw e}},t)}));return}else if(r===o.HALT){if(t.meta.finallyHandler&&!t.meta.handlingFinally){t.meta.handlingFinally=true;e=t.meta.finallyHandler}else{if(t.meta.onHalt){t.meta.onHalt()}if(t.meta.currentException){if(t.meta.reject){t.meta.reject(t.meta.currentException);return}else{throw t.meta.currentException}}else{return}}}else{e=r}}}unifiedEval(e,t){var r=[t];var n=false;var i=false;if(e.args){for(var a=0;a{r=this.wrapArrays(r);Promise.all(r).then((function(r){if(i){this.unwrapAsyncs(r)}try{var a=e.op.apply(e,r);t(a)}catch(e){n(e)}})).catch((function(e){n(e)}))}))}else{if(i){this.unwrapAsyncs(r)}return e.op.apply(e,r)}}_scriptAttrs=null;getScriptAttributes(){if(this._scriptAttrs==null){this._scriptAttrs=r.attributes.replace(/ /g,"").split(",")}return this._scriptAttrs}getScript(e){for(var t=0;t{this.initElement(e,e instanceof HTMLScriptElement&&e.type==="text/hyperscript"?document.body:e)}))}}initElement(e,t){if(e.closest&&e.closest(r.disableSelector)){return}var n=this.getInternalData(e);if(!n.initialized){var i=this.getScript(e);if(i){try{n.initialized=true;n.script=i;const r=this.lexer,s=this.parser;var a=r.tokenize(i);var o=s.parseHyperScript(a);if(!o)return;o.apply(t||e,e);setTimeout((()=>{this.triggerEvent(t||e,"load",{hyperscript:true})}),1)}catch(t){this.triggerEvent(e,"exception",{error:t});console.error("hyperscript errors were found on the following element:",e,"\n\n",t.message,t.stack)}}}}internalDataMap=new WeakMap;getInternalData(e){var t=this.internalDataMap.get(e);if(typeof t==="undefined"){this.internalDataMap.set(e,t={})}return t}typeCheck(e,t,r){if(e==null&&r){return true}var n=Object.prototype.toString.call(e).slice(8,-1);return n===t}getElementScope(e){var t=e.meta&&e.meta.owner;if(t){var r=this.getInternalData(t);var n="elementScope";if(e.meta.feature&&e.meta.feature.behavior){n=e.meta.feature.behavior+"Scope"}var i=c(r,n);return i}else{return{}}}isReservedWord(e){return["meta","it","result","locals","event","target","detail","sender","body"].includes(e)}isHyperscriptContext(e){return e instanceof s}resolveSymbol(t,r,n){if(t==="me"||t==="my"||t==="I"){return r.me}if(t==="it"||t==="its"||t==="result"){return r.result}if(t==="you"||t==="your"||t==="yourself"){return r.you}else{if(n==="global"){return e[t]}else if(n==="element"){var i=this.getElementScope(r);return i[t]}else if(n==="local"){return r.locals[t]}else{if(r.meta&&r.meta.context){var a=r.meta.context[t];if(typeof a!=="undefined"){return a}}if(this.isHyperscriptContext(r)&&!this.isReservedWord(t)){var o=r.locals[t]}else{var o=r[t]}if(typeof o!=="undefined"){return o}else{var i=this.getElementScope(r);o=i[t];if(typeof o!=="undefined"){return o}else{return e[t]}}}}}setSymbol(t,r,n,i){if(n==="global"){e[t]=i}else if(n==="element"){var a=this.getElementScope(r);a[t]=i}else if(n==="local"){r.locals[t]=i}else{if(this.isHyperscriptContext(r)&&!this.isReservedWord(t)&&typeof r.locals[t]!=="undefined"){r.locals[t]=i}else{var a=this.getElementScope(r);var o=a[t];if(typeof o!=="undefined"){a[t]=i}else{if(this.isHyperscriptContext(r)&&!this.isReservedWord(t)){r.locals[t]=i}else{r[t]=i}}}}}findNext(e,t){if(e){if(e.resolveNext){return e.resolveNext(t)}else if(e.next){return e.next}else{return this.findNext(e.parent,t)}}}flatGet(e,t,r){if(e!=null){var n=r(e,t);if(typeof n!=="undefined"){return n}if(this.shouldAutoIterate(e)){var i=[];for(var a of e){var o=r(a,t);i.push(o)}return i}}}resolveProperty(e,t){return this.flatGet(e,t,((e,t)=>e[t]))}resolveAttribute(e,t){return this.flatGet(e,t,((e,t)=>e.getAttribute&&e.getAttribute(t)))}resolveStyle(e,t){return this.flatGet(e,t,((e,t)=>e.style&&e.style[t]))}resolveComputedStyle(e,t){return this.flatGet(e,t,((e,t)=>getComputedStyle(e).getPropertyValue(t)))}assignToNamespace(t,r,n,i){let a;if(typeof document!=="undefined"&&t===document.body){a=e}else{a=this.getHyperscriptFeatures(t)}var o;while((o=r.shift())!==undefined){var s=a[o];if(s==null){s={};a[o]=s}a=s}a[n]=i}getHyperTrace(e,t){var r=[];var n=e;while(n.meta.caller){n=n.meta.caller}if(n.meta.traceMap){return n.meta.traceMap.get(t,r)}}registerHyperTrace(e,t){var r=[];var n=null;while(e!=null){r.push(e);n=e;e=e.meta.caller}if(n.meta.traceMap==null){n.meta.traceMap=new Map}if(!n.meta.traceMap.get(t)){var i={trace:r,print:function(e){e=e||console.error;e("hypertrace /// ");var t=0;for(var n=0;n",i.meta.feature.displayName.padEnd(t+2),"-",i.meta.owner)}}};n.meta.traceMap.set(t,i)}}escapeSelector(e){return e.replace(/:/g,(function(e){return"\\"+e}))}nullCheck(e,t){if(e==null){throw new Error("'"+t.sourceFor()+"' is null")}}isEmpty(e){return e==undefined||e.length===0}doesExist(e){if(e==null){return false}if(this.shouldAutoIterate(e)){for(const t of e){return true}}return false}getRootNode(e){if(e&&e instanceof Node){var t=e.getRootNode();if(t instanceof Document||t instanceof ShadowRoot)return t}return document}getEventQueueFor(e,t){let r=this.getInternalData(e);var n=r.eventQueues;if(n==null){n=new Map;r.eventQueues=n}var i=n.get(t);if(i==null){i={queue:[],executing:false};n.set(t,i)}return i}hyperscriptUrl="document"in e?document.currentScript.src:null}class s{constructor(t,r,n,i,a){this.meta={parser:a.parser,lexer:a.lexer,runtime:a,owner:t,feature:r,iterators:{},ctx:this};this.locals={};this.me=n,this.you=undefined;this.result=undefined;this.event=i;this.target=i?i.target:null;this.detail=i?i.detail:null;this.sender=i?i.detail?i.detail.sender:null:null;this.body="document"in e?document.body:null;a.addFeatures(t,this)}}class u{constructor(e,t,r){this._css=e;this.relativeToElement=t;this.escape=r;this[l]=true}get css(){if(this.escape){return o.prototype.escapeSelector(this._css)}else{return this._css}}get className(){return this._css.substr(1)}get id(){return this.className()}contains(e){for(let t of this){if(t.contains(e)){return true}}return false}get length(){return this.selectMatches().length}[Symbol.iterator](){let e=this.selectMatches();return e[Symbol.iterator]()}selectMatches(){let e=o.prototype.getRootNode(this.relativeToElement).querySelectorAll(this.css);return e}}const l=Symbol();function c(e,t){var r=e[t];if(r){return r}else{var n={};e[t]=n;return n}}function f(e){try{return JSON.parse(e)}catch(e){m(e);return null}}function m(e){if(console.error){console.error(e)}else if(console.log){console.log("ERROR: ",e)}}function p(e,t){return new(e.bind.apply(e,[e].concat(t)))}function h(t){t.addLeafExpression("parenthesized",(function(e,t,r){if(r.matchOpToken("(")){var n=r.clearFollows();try{var i=e.requireElement("expression",r)}finally{r.restoreFollows(n)}r.requireOpToken(")");return i}}));t.addLeafExpression("string",(function(e,t,r){var i=r.matchTokenType("STRING");if(!i)return;var a=i.value;var o;if(i.template){var s=n.tokenize(a,true);o=e.parseStringTemplate(s)}else{o=[]}return{type:"string",token:i,args:o,op:function(e){var t="";for(var r=1;re instanceof Element))}get css(){let e="",t=0;for(const r of this.templateParts){if(r instanceof Element){e+="[data-hs-query-id='"+t+++"']"}else e+=r}return e}[Symbol.iterator](){this.elements.forEach(((e,t)=>e.dataset.hsQueryId=t));const e=super[Symbol.iterator]();this.elements.forEach((e=>e.removeAttribute("data-hs-query-id")));return e}}t.addLeafExpression("queryRef",(function(e,t,i){var a=i.matchOpToken("<");if(!a)return;var o=i.consumeUntil("/");i.requireOpToken("/");i.requireOpToken(">");var s=o.map((function(e){if(e.type==="STRING"){return'"'+e.value+'"'}else{return e.value}})).join("");var l,c,f;if(s.indexOf("$")>=0){l=true;c=n.tokenize(s,true);f=e.parseStringTemplate(c)}return{type:"queryRef",css:s,args:f,op:function(e,...t){if(l){return new r(s,e.me,t)}else{return new u(s,e.me)}},evaluate:function(e){return t.unifiedEval(this,e)}}}));t.addLeafExpression("attributeRef",(function(e,t,r){var n=r.matchTokenType("ATTRIBUTE_REF");if(!n)return;if(!n.value)return;var i=n.value;if(i.indexOf("[")===0){var a=i.substring(2,i.length-1)}else{var a=i.substring(1)}var o="["+a+"]";var s=a.split("=");var u=s[0];var l=s[1];if(l){if(l.indexOf('"')===0){l=l.substring(1,l.length-1)}}return{type:"attributeRef",name:u,css:o,value:l,op:function(e){var t=e.you||e.me;if(t){return t.getAttribute(u)}},evaluate:function(e){return t.unifiedEval(this,e)}}}));t.addLeafExpression("styleRef",(function(e,t,r){var n=r.matchTokenType("STYLE_REF");if(!n)return;if(!n.value)return;var i=n.value.substr(1);if(i.startsWith("computed-")){i=i.substr("computed-".length);return{type:"computedStyleRef",name:i,op:function(e){var r=e.you||e.me;if(r){return t.resolveComputedStyle(r,i)}},evaluate:function(e){return t.unifiedEval(this,e)}}}else{return{type:"styleRef",name:i,op:function(e){var r=e.you||e.me;if(r){return t.resolveStyle(r,i)}},evaluate:function(e){return t.unifiedEval(this,e)}}}}));t.addGrammarElement("objectKey",(function(e,t,r){var n;if(n=r.matchTokenType("STRING")){return{type:"objectKey",key:n.value,evaluate:function(){return n.value}}}else if(r.matchOpToken("[")){var i=e.parseElement("expression",r);r.requireOpToken("]");return{type:"objectKey",expr:i,args:[i],op:function(e,t){return t},evaluate:function(e){return t.unifiedEval(this,e)}}}else{var a="";do{n=r.matchTokenType("IDENTIFIER")||r.matchOpToken("-");if(n)a+=n.value}while(n);return{type:"objectKey",key:a,evaluate:function(){return a}}}}));t.addLeafExpression("objectLiteral",(function(e,t,r){if(!r.matchOpToken("{"))return;var n=[];var i=[];if(!r.matchOpToken("}")){do{var a=e.requireElement("objectKey",r);r.requireOpToken(":");var o=e.requireElement("expression",r);i.push(o);n.push(a)}while(r.matchOpToken(","));r.requireOpToken("}")}return{type:"objectLiteral",args:[n,i],op:function(e,t,r){var n={};for(var i=0;i");var a=e.requireElement("expression",r);return{type:"blockLiteral",args:n,expr:a,evaluate:function(e){var t=function(){for(var t=0;t=0;a--){var o=i[a];if(o.compareDocumentPosition(e)===Node.DOCUMENT_POSITION_FOLLOWING){return o}}if(n){return i[i.length-1]}};var f=function(e,t,r,n){var i=[];o.prototype.forEach(t,(function(t){if(t.matches(r)||t===e){i.push(t)}}));for(var a=0;a","<=",">=","==","===","!=","!==");var a=i?i.value:null;var o=true;var s=false;if(a==null){if(r.matchToken("is")||r.matchToken("am")){if(r.matchToken("not")){if(r.matchToken("in")){a="not in"}else if(r.matchToken("a")){a="not a";s=true}else if(r.matchToken("empty")){a="not empty";o=false}else{a="!="}}else if(r.matchToken("in")){a="in"}else if(r.matchToken("a")){a="a";s=true}else if(r.matchToken("empty")){a="empty";o=false}else if(r.matchToken("less")){r.requireToken("than");if(r.matchToken("or")){r.requireToken("equal");r.requireToken("to");a="<="}else{a="<"}}else if(r.matchToken("greater")){r.requireToken("than");if(r.matchToken("or")){r.requireToken("equal");r.requireToken("to");a=">="}else{a=">"}}else{a="=="}}else if(r.matchToken("exist")||r.matchToken("exists")){a="exist";o=false}else if(r.matchToken("matches")||r.matchToken("match")){a="match"}else if(r.matchToken("contains")||r.matchToken("contain")){a="contain"}else if(r.matchToken("includes")||r.matchToken("include")){a="include"}else if(r.matchToken("do")||r.matchToken("does")){r.requireToken("not");if(r.matchToken("matches")||r.matchToken("match")){a="not match"}else if(r.matchToken("contains")||r.matchToken("contain")){a="not contain"}else if(r.matchToken("exist")||r.matchToken("exist")){a="not exist";o=false}else if(r.matchToken("include")){a="not include"}else{e.raiseParseError(r,"Expected matches or contains")}}}if(a){var u,l,c;if(s){u=r.requireTokenType("IDENTIFIER");l=!r.matchOpToken("!")}else if(o){c=e.requireElement("mathExpression",r);if(a==="match"||a==="not match"){c=c.css?c.css:c}}var f=n;n={type:"comparisonOperator",operator:a,typeName:u,nullOk:l,lhs:n,rhs:c,args:[n,c],op:function(e,r,n){if(a==="=="){return r==n}else if(a==="!="){return r!=n}if(a==="match"){return r!=null&&v(f,r,n)}if(a==="not match"){return r==null||!v(f,r,n)}if(a==="in"){return n!=null&&h(c,n,r)}if(a==="not in"){return n==null||!h(c,n,r)}if(a==="contain"){return r!=null&&h(f,r,n)}if(a==="not contain"){return r==null||!h(f,r,n)}if(a==="include"){return r!=null&&h(f,r,n)}if(a==="not include"){return r==null||!h(f,r,n)}if(a==="==="){return r===n}else if(a==="!=="){return r!==n}else if(a==="<"){return r"){return r>n}else if(a==="<="){return r<=n}else if(a===">="){return r>=n}else if(a==="empty"){return t.isEmpty(r)}else if(a==="not empty"){return!t.isEmpty(r)}else if(a==="exist"){return t.doesExist(r)}else if(a==="not exist"){return!t.doesExist(r)}else if(a==="a"){return t.typeCheck(r,u.value,l)}else if(a==="not a"){return!t.typeCheck(r,u.value,l)}else{throw"Unknown comparison : "+a}},evaluate:function(e){return t.unifiedEval(this,e)}}}return n}));t.addGrammarElement("comparisonExpression",(function(e,t,r){return e.parseAnyOf(["comparisonOperator","mathExpression"],r)}));t.addGrammarElement("logicalOperator",(function(e,t,r){var n=e.parseElement("comparisonExpression",r);var i,a=null;i=r.matchToken("and")||r.matchToken("or");while(i){a=a||i;if(a.value!==i.value){e.raiseParseError(r,"You must parenthesize logical operations with different operators")}var o=e.requireElement("comparisonExpression",r);const s=i.value;n={type:"logicalOperator",operator:s,lhs:n,rhs:o,args:[n,o],op:function(e,t,r){if(s==="and"){return t&&r}else{return t||r}},evaluate:function(e){return t.unifiedEval(this,e)}};i=r.matchToken("and")||r.matchToken("or")}return n}));t.addGrammarElement("logicalExpression",(function(e,t,r){return e.parseAnyOf(["logicalOperator","mathExpression"],r)}));t.addGrammarElement("asyncExpression",(function(e,t,r){if(r.matchToken("async")){var n=e.requireElement("logicalExpression",r);var i={type:"asyncExpression",value:n,evaluate:function(e){return{asyncWrapper:true,value:this.value.evaluate(e)}}};return i}else{return e.parseElement("logicalExpression",r)}}));t.addGrammarElement("expression",(function(e,t,r){r.matchToken("the");return e.parseElement("asyncExpression",r)}));t.addGrammarElement("assignableExpression",(function(e,t,r){r.matchToken("the");var n=e.parseElement("primaryExpression",r);if(n&&(n.type==="symbol"||n.type==="ofExpression"||n.type==="propertyAccess"||n.type==="attributeRefAccess"||n.type==="attributeRef"||n.type==="styleRef"||n.type==="arrayIndex"||n.type==="possessive")){return n}else{e.raiseParseError(r,"A target expression must be writable. The expression type '"+(n&&n.type)+"' is not.")}return n}));t.addGrammarElement("hyperscript",(function(e,t,r){var n=[];if(r.hasMore()){while(e.featureStart(r.currentToken())||r.currentToken().value==="("){var i=e.requireElement("feature",r);n.push(i);r.matchToken("end")}}return{type:"hyperscript",features:n,apply:function(e,t,r){for(const i of n){i.install(e,t,r)}}}}));var d=function(e){var t=[];if(e.token(0).value==="("&&(e.token(1).value===")"||e.token(2).value===","||e.token(2).value===")")){e.matchOpToken("(");do{t.push(e.requireTokenType("IDENTIFIER"))}while(e.matchOpToken(","));e.requireOpToken(")")}return t};t.addFeature("on",(function(e,t,r){if(!r.matchToken("on"))return;var n=false;if(r.matchToken("every")){n=true}var i=[];var a=null;do{var o=e.requireElement("eventName",r,"Expected event name");var s=o.evaluate();if(a){a=a+" or "+s}else{a="on "+s}var u=d(r);var l=null;if(r.matchOpToken("[")){l=e.requireElement("expression",r);r.requireOpToken("]")}var c,f,m;if(r.currentToken().type==="NUMBER"){var p=r.consumeToken();if(!p.value)return;c=parseInt(p.value);if(r.matchToken("to")){var h=r.consumeToken();if(!h.value)return;f=parseInt(h.value)}else if(r.matchToken("and")){m=true;r.requireToken("on")}}var v,E;if(s==="intersection"){v={};if(r.matchToken("with")){v["with"]=e.requireElement("expression",r).evaluate()}if(r.matchToken("having")){do{if(r.matchToken("margin")){v["rootMargin"]=e.requireElement("stringLike",r).evaluate()}else if(r.matchToken("threshold")){v["threshold"]=e.requireElement("expression",r).evaluate()}else{e.raiseParseError(r,"Unknown intersection config specification")}}while(r.matchToken("and"))}}else if(s==="mutation"){E={};if(r.matchToken("of")){do{if(r.matchToken("anything")){E["attributes"]=true;E["subtree"]=true;E["characterData"]=true;E["childList"]=true}else if(r.matchToken("childList")){E["childList"]=true}else if(r.matchToken("attributes")){E["attributes"]=true;E["attributeOldValue"]=true}else if(r.matchToken("subtree")){E["subtree"]=true}else if(r.matchToken("characterData")){E["characterData"]=true;E["characterDataOldValue"]=true}else if(r.currentToken().type==="ATTRIBUTE_REF"){var T=r.consumeToken();if(E["attributeFilter"]==null){E["attributeFilter"]=[]}if(T.value.indexOf("@")==0){E["attributeFilter"].push(T.value.substring(1))}else{e.raiseParseError(r,"Only shorthand attribute references are allowed here")}}else{e.raiseParseError(r,"Unknown mutation config specification")}}while(r.matchToken("or"))}else{E["attributes"]=true;E["characterData"]=true;E["childList"]=true}}var y=null;var k=false;if(r.matchToken("from")){if(r.matchToken("elsewhere")){k=true}else{y=e.parseElement("expression",r);if(!y){e.raiseParseError(r,'Expected either target value or "elsewhere".')}}}if(y===null&&k===false&&r.matchToken("elsewhere")){k=true}if(r.matchToken("in")){var x=e.parseElement("unaryExpression",r)}if(r.matchToken("debounced")){r.requireToken("at");var g=e.requireElement("expression",r);var b=g.evaluate({})}else if(r.matchToken("throttled")){r.requireToken("at");var g=e.requireElement("expression",r);var w=g.evaluate({})}i.push({execCount:0,every:n,on:s,args:u,filter:l,from:y,inExpr:x,elsewhere:k,startCount:c,endCount:f,unbounded:m,debounceTime:b,throttleTime:w,mutationSpec:E,intersectionSpec:v,debounced:undefined,lastExec:undefined})}while(r.matchToken("or"));var S=true;if(!n){if(r.matchToken("queue")){if(r.matchToken("all")){var q=true;var S=false}else if(r.matchToken("first")){var N=true}else if(r.matchToken("none")){var I=true}else{r.requireToken("last")}}}var R=e.requireElement("commandList",r);e.ensureTerminated(R);var C,A;if(r.matchToken("catch")){C=r.requireTokenType("IDENTIFIER").value;A=e.requireElement("commandList",r);e.ensureTerminated(A)}if(r.matchToken("finally")){var O=e.requireElement("commandList",r);e.ensureTerminated(O)}var L={displayName:a,events:i,start:R,every:n,execCount:0,errorHandler:A,errorSymbol:C,execute:function(e){let r=t.getEventQueueFor(e.me,L);if(r.executing&&n===false){if(I||N&&r.queue.length>0){return}if(S){r.queue.length=0}r.queue.push(e);return}L.execCount++;r.executing=true;e.meta.onHalt=function(){r.executing=false;var e=r.queue.shift();if(e){setTimeout((function(){L.execute(e)}),1)}};e.meta.reject=function(r){console.error(r.message?r.message:r);var n=t.getHyperTrace(e,r);if(n){n.print()}t.triggerEvent(e.me,"exception",{error:r})};R.execute(e)},install:function(e,r){for(const r of L.events){var n;if(r.elsewhere){n=[document]}else if(r.from){n=r.from.evaluate(t.makeContext(e,L,e,null))}else{n=[e]}t.implicitLoop(n,(function(n){var i=r.on;if(n==null){console.warn("'%s' feature ignored because target does not exists:",a,e);return}if(r.mutationSpec){i="hyperscript:mutation";const e=new MutationObserver((function(e,r){if(!L.executing){t.triggerEvent(n,i,{mutationList:e,observer:r})}}));e.observe(n,r.mutationSpec)}if(r.intersectionSpec){i="hyperscript:insersection";const e=new IntersectionObserver((function(r){for(const o of r){var a={observer:e};a=Object.assign(a,o);a["intersecting"]=o.isIntersecting;t.triggerEvent(n,i,a)}}),r.intersectionSpec);e.observe(n)}var o=n.addEventListener||n.on;o.call(n,i,(function a(o){if(typeof Node!=="undefined"&&e instanceof Node&&n!==e&&!e.isConnected){n.removeEventListener(i,a);return}var s=t.makeContext(e,L,e,o);if(r.elsewhere&&e.contains(o.target)){return}if(r.from){s.result=n}for(const e of r.args){let t=s.event[e.value];if(t!==undefined){s.locals[e.value]=t}else if("detail"in s.event){s.locals[e.value]=s.event["detail"][e.value]}}s.meta.errorHandler=A;s.meta.errorSymbol=C;s.meta.finallyHandler=O;if(r.filter){var u=s.meta.context;s.meta.context=s.event;try{var l=r.filter.evaluate(s);if(l){}else{return}}finally{s.meta.context=u}}if(r.inExpr){var c=o.target;while(true){if(c.matches&&c.matches(r.inExpr.css)){s.result=c;break}else{c=c.parentElement;if(c==null){return}}}}r.execCount++;if(r.startCount){if(r.endCount){if(r.execCountr.endCount){return}}else if(r.unbounded){if(r.execCount{var a=false;for(const s of i){var o=n=>{e.result=n;if(s.args){for(const t of s.args){e.locals[t.value]=n[t.value]||(n.detail?n.detail[t.value]:null)}}if(!a){a=true;r(t.findNext(this,e))}};if(s.name){n.addEventListener(s.name,o,{once:true})}else if(s.time!=null){setTimeout(o,s.time,s.time)}}}))}};return n}else{var s;if(r.matchToken("a")){r.requireToken("tick");s=0}else{s=e.requireElement("expression",r)}n={type:"waitCmd",time:s,args:[s],op:function(e,r){return new Promise((n=>{setTimeout((()=>{n(t.findNext(this,e))}),r)}))},execute:function(e){return t.unifiedExec(this,e)}};return n}}));t.addGrammarElement("dotOrColonPath",(function(e,t,r){var n=r.matchTokenType("IDENTIFIER");if(n){var i=[n.value];var a=r.matchOpToken(".")||r.matchOpToken(":");if(a){do{i.push(r.requireTokenType("IDENTIFIER","NUMBER").value)}while(r.matchOpToken(a.value))}return{type:"dotOrColonPath",path:i,evaluate:function(){return i.join(a?a.value:"")}}}}));t.addGrammarElement("eventName",(function(e,t,r){var n;if(n=r.matchTokenType("STRING")){return{evaluate:function(){return n.value}}}return e.parseElement("dotOrColonPath",r)}));function E(e,t,r,n){var i=t.requireElement("eventName",n);var a=t.parseElement("namedArgumentList",n);if(e==="send"&&n.matchToken("to")||e==="trigger"&&n.matchToken("on")){var o=t.requireElement("expression",n)}else{var o=t.requireElement("implicitMeTarget",n)}var s={eventName:i,details:a,to:o,args:[o,i,a],op:function(e,t,n,i){r.nullCheck(t,o);r.forEach(t,(function(t){r.triggerEvent(t,n,i,e.me)}));return r.findNext(s,e)}};return s}t.addCommand("trigger",(function(e,t,r){if(r.matchToken("trigger")){return E("trigger",e,t,r)}}));t.addCommand("send",(function(e,t,r){if(r.matchToken("send")){return E("send",e,t,r)}}));var T=function(e,t,r,n){if(n){if(e.commandBoundary(r.currentToken())){e.raiseParseError(r,"'return' commands must return a value. If you do not wish to return a value, use 'exit' instead.")}else{var i=e.requireElement("expression",r)}}var a={value:i,args:[i],op:function(e,r){var n=e.meta.resolve;e.meta.returned=true;e.meta.returnValue=r;if(n){if(r){n(r)}else{n()}}return t.HALT}};return a};t.addCommand("return",(function(e,t,r){if(r.matchToken("return")){return T(e,t,r,true)}}));t.addCommand("exit",(function(e,t,r){if(r.matchToken("exit")){return T(e,t,r,false)}}));t.addCommand("halt",(function(e,t,r){if(r.matchToken("halt")){if(r.matchToken("the")){r.requireToken("event");if(r.matchOpToken("'")){r.requireToken("s")}var n=true}if(r.matchToken("bubbling")){var i=true}else if(r.matchToken("default")){var a=true}var o=T(e,t,r,false);var s={keepExecuting:true,bubbling:i,haltDefault:a,exit:o,op:function(e){if(e.event){if(i){e.event.stopPropagation()}else if(a){e.event.preventDefault()}else{e.event.stopPropagation();e.event.preventDefault()}if(n){return t.findNext(this,e)}else{return o}}}};return s}}));t.addCommand("log",(function(e,t,r){if(!r.matchToken("log"))return;var n=[e.parseElement("expression",r)];while(r.matchOpToken(",")){n.push(e.requireElement("expression",r))}if(r.matchToken("with")){var i=e.requireElement("expression",r)}var a={exprs:n,withExpr:i,args:[i,n],op:function(e,r,n){if(r){r.apply(null,n)}else{console.log.apply(null,n)}return t.findNext(this,e)}};return a}));t.addCommand("throw",(function(e,t,r){if(!r.matchToken("throw"))return;var n=e.requireElement("expression",r);var i={expr:n,args:[n],op:function(e,r){t.registerHyperTrace(e,r);throw r}};return i}));var y=function(e,t,r){var n=e.requireElement("expression",r);var i={expr:n,args:[n],op:function(e,r){e.result=r;return t.findNext(i,e)}};return i};t.addCommand("call",(function(e,t,r){if(!r.matchToken("call"))return;var n=y(e,t,r);if(n.expr&&n.expr.type!=="functionCall"){e.raiseParseError(r,"Must be a function invocation")}return n}));t.addCommand("get",(function(e,t,r){if(r.matchToken("get")){return y(e,t,r)}}));t.addCommand("make",(function(e,t,r){if(!r.matchToken("make"))return;r.matchToken("a")||r.matchToken("an");var n=e.requireElement("expression",r);var i=[];if(n.type!=="queryRef"&&r.matchToken("from")){do{i.push(e.requireElement("expression",r))}while(r.matchOpToken(","))}if(r.matchToken("called")){var a=e.requireElement("symbol",r)}var o;if(n.type==="queryRef"){o={op:function(e){var r,i="div",o,s=[];var u=/(?:(^|#|\.)([^#\. ]+))/g;while(r=u.exec(n.css)){if(r[1]==="")i=r[2].trim();else if(r[1]==="#")o=r[2].trim();else s.push(r[2].trim())}var l=document.createElement(i);if(o!==undefined)l.id=o;for(var c=0;c{if(!r.matchToken("pick"))return;r.matchToken("the");if(r.matchToken("item")||r.matchToken("items")||r.matchToken("character")||r.matchToken("characters")){const n=g(e,t,r);r.requireToken("from");const i=e.requireElement("expression",r);return{args:[i,n.from,n.to],op(e,r,i,a){if(n.toEnd)a=r.length;if(!n.includeStart)i++;if(n.includeEnd)a++;if(a==null||a==undefined)a=i+1;e.result=r.slice(i,a);return t.findNext(this,e)}}}if(r.matchToken("match")){r.matchToken("of");const n=e.parseElement("expression",r);let i="";if(r.matchOpToken("|")){i=r.requireToken("identifier").value}r.requireToken("from");const a=e.parseElement("expression",r);return{args:[a,n],op(e,r,n){e.result=new RegExp(n,i).exec(r);return t.findNext(this,e)}}}if(r.matchToken("matches")){r.matchToken("of");const n=e.parseElement("expression",r);let i="gu";if(r.matchOpToken("|")){i="g"+r.requireToken("identifier").value.replace("g","")}console.log("flags",i);r.requireToken("from");const a=e.parseElement("expression",r);return{args:[a,n],op(e,r,n){e.result=new w(n,i,r);return t.findNext(this,e)}}}}));t.addCommand("increment",(function(e,t,r){if(!r.matchToken("increment"))return;var n;var i=e.parseElement("assignableExpression",r);if(r.matchToken("by")){n=e.requireElement("expression",r)}var a={type:"implicitIncrementOp",target:i,args:[i,n],op:function(e,t,r){t=t?parseFloat(t):0;r=n?parseFloat(r):1;var i=t+r;e.result=i;return i},evaluate:function(e){return t.unifiedEval(this,e)}};return k(e,t,r,i,a)}));t.addCommand("decrement",(function(e,t,r){if(!r.matchToken("decrement"))return;var n;var i=e.parseElement("assignableExpression",r);if(r.matchToken("by")){n=e.requireElement("expression",r)}var a={type:"implicitDecrementOp",target:i,args:[i,n],op:function(e,t,r){t=t?parseFloat(t):0;r=n?parseFloat(r):1;var i=t-r;e.result=i;return i},evaluate:function(e){return t.unifiedEval(this,e)}};return k(e,t,r,i,a)}));function S(e,t){var r="text";var n;e.matchToken("a")||e.matchToken("an");if(e.matchToken("json")||e.matchToken("Object")){r="json"}else if(e.matchToken("response")){r="response"}else if(e.matchToken("html")){r="html"}else if(e.matchToken("text")){}else{n=t.requireElement("dotOrColonPath",e).evaluate()}return{type:r,conversion:n}}t.addCommand("fetch",(function(e,t,r){if(!r.matchToken("fetch"))return;var n=e.requireElement("stringLike",r);if(r.matchToken("as")){var i=S(r,e)}if(r.matchToken("with")&&r.currentToken().value!=="{"){var a=e.parseElement("nakedNamedArgumentList",r)}else{var a=e.parseElement("objectLiteral",r)}if(i==null&&r.matchToken("as")){i=S(r,e)}var o=i?i.type:"text";var s=i?i.conversion:null;var u={url:n,argExpressions:a,args:[n,a],op:function(e,r,n){var i=n||{};i["sender"]=e.me;i["headers"]=i["headers"]||{};var a=new AbortController;let l=e.me.addEventListener("fetch:abort",(function(){a.abort()}),{once:true});i["signal"]=a.signal;t.triggerEvent(e.me,"hyperscript:beforeFetch",i);t.triggerEvent(e.me,"fetch:beforeRequest",i);n=i;var c=false;if(n.timeout){setTimeout((function(){if(!c){a.abort()}}),n.timeout)}return fetch(r,n).then((function(r){let n={response:r};t.triggerEvent(e.me,"fetch:afterResponse",n);r=n.response;if(o==="response"){e.result=r;t.triggerEvent(e.me,"fetch:afterRequest",{result:r});c=true;return t.findNext(u,e)}if(o==="json"){return r.json().then((function(r){e.result=r;t.triggerEvent(e.me,"fetch:afterRequest",{result:r});c=true;return t.findNext(u,e)}))}return r.text().then((function(r){if(s)r=t.convertValue(r,s);if(o==="html")r=t.convertValue(r,"Fragment");e.result=r;t.triggerEvent(e.me,"fetch:afterRequest",{result:r});c=true;return t.findNext(u,e)}))})).catch((function(r){t.triggerEvent(e.me,"fetch:error",{reason:r});throw r})).finally((function(){e.me.removeEventListener("fetch:abort",l)}))}};return u}))}function v(e){e.addCommand("settle",(function(e,t,r){if(r.matchToken("settle")){if(!e.commandBoundary(r.currentToken())){var n=e.requireElement("expression",r)}else{var n=e.requireElement("implicitMeTarget",r)}var i={type:"settleCmd",args:[n],op:function(e,r){t.nullCheck(r,n);var a=null;var o=false;var s=false;var u=new Promise((function(e){a=e}));r.addEventListener("transitionstart",(function(){s=true}),{once:true});setTimeout((function(){if(!s&&!o){a(t.findNext(i,e))}}),500);r.addEventListener("transitionend",(function(){if(!o){a(t.findNext(i,e))}}),{once:true});return u},execute:function(e){return t.unifiedExec(this,e)}};return i}}));e.addCommand("add",(function(e,t,r){if(r.matchToken("add")){var n=e.parseElement("classRef",r);var i=null;var a=null;if(n==null){i=e.parseElement("attributeRef",r);if(i==null){a=e.parseElement("styleLiteral",r);if(a==null){e.raiseParseError(r,"Expected either a class reference or attribute expression")}}}else{var o=[n];while(n=e.parseElement("classRef",r)){o.push(n)}}if(r.matchToken("to")){var s=e.requireElement("expression",r)}else{var s=e.requireElement("implicitMeTarget",r)}if(r.matchToken("when")){if(a){e.raiseParseError(r,"Only class and properties are supported with a when clause")}var u=e.requireElement("expression",r)}if(o){return{classRefs:o,to:s,args:[s,o],op:function(e,r,n){t.nullCheck(r,s);t.forEach(n,(function(n){t.implicitLoop(r,(function(r){if(u){e.result=r;let i=t.evaluateNoPromise(u,e);if(i){if(r instanceof Element)r.classList.add(n.className)}else{if(r instanceof Element)r.classList.remove(n.className)}e.result=null}else{if(r instanceof Element)r.classList.add(n.className)}}))}));return t.findNext(this,e)}}}else if(i){return{type:"addCmd",attributeRef:i,to:s,args:[s],op:function(e,r,n){t.nullCheck(r,s);t.implicitLoop(r,(function(r){if(u){e.result=r;let n=t.evaluateNoPromise(u,e);if(n){r.setAttribute(i.name,i.value)}else{r.removeAttribute(i.name)}e.result=null}else{r.setAttribute(i.name,i.value)}}));return t.findNext(this,e)},execute:function(e){return t.unifiedExec(this,e)}}}else{return{type:"addCmd",cssDeclaration:a,to:s,args:[s,a],op:function(e,r,n){t.nullCheck(r,s);t.implicitLoop(r,(function(e){e.style.cssText+=n}));return t.findNext(this,e)},execute:function(e){return t.unifiedExec(this,e)}}}}}));e.addGrammarElement("styleLiteral",(function(e,t,r){if(!r.matchOpToken("{"))return;var n=[""];var i=[];while(r.hasMore()){if(r.matchOpToken("\\")){r.consumeToken()}else if(r.matchOpToken("}")){break}else if(r.matchToken("$")){var a=r.matchOpToken("{");var o=e.parseElement("expression",r);if(a)r.requireOpToken("}");i.push(o);n.push("")}else{var s=r.consumeToken();n[n.length-1]+=r.source.substring(s.start,s.end)}n[n.length-1]+=r.lastWhitespace()}return{type:"styleLiteral",args:[i],op:function(e,t){var r="";n.forEach((function(e,n){r+=e;if(n in t)r+=t[n]}));return r},evaluate:function(e){return t.unifiedEval(this,e)}}}));e.addCommand("remove",(function(e,t,r){if(r.matchToken("remove")){var n=e.parseElement("classRef",r);var i=null;var a=null;if(n==null){i=e.parseElement("attributeRef",r);if(i==null){a=e.parseElement("expression",r);if(a==null){e.raiseParseError(r,"Expected either a class reference, attribute expression or value expression")}}}else{var o=[n];while(n=e.parseElement("classRef",r)){o.push(n)}}if(r.matchToken("from")){var s=e.requireElement("expression",r)}else{if(a==null){var s=e.requireElement("implicitMeTarget",r)}}if(a){return{elementExpr:a,from:s,args:[a,s],op:function(e,r,n){t.nullCheck(r,a);t.implicitLoop(r,(function(e){if(e.parentElement&&(n==null||n.contains(e))){e.parentElement.removeChild(e)}}));return t.findNext(this,e)}}}else{return{classRefs:o,attributeRef:i,elementExpr:a,from:s,args:[o,s],op:function(e,r,n){t.nullCheck(n,s);if(r){t.forEach(r,(function(e){t.implicitLoop(n,(function(t){t.classList.remove(e.className)}))}))}else{t.implicitLoop(n,(function(e){e.removeAttribute(i.name)}))}return t.findNext(this,e)}}}}}));e.addCommand("toggle",(function(e,t,r){if(r.matchToken("toggle")){r.matchAnyToken("the","my");if(r.currentToken().type==="STYLE_REF"){let t=r.consumeToken();var n=t.value.substr(1);var a=true;var o=i(e,r,n);if(r.matchToken("of")){r.pushFollow("with");try{var s=e.requireElement("expression",r)}finally{r.popFollow()}}else{var s=e.requireElement("implicitMeTarget",r)}}else if(r.matchToken("between")){var u=true;var l=e.parseElement("classRef",r);r.requireToken("and");var c=e.requireElement("classRef",r)}else{var l=e.parseElement("classRef",r);var f=null;if(l==null){f=e.parseElement("attributeRef",r);if(f==null){e.raiseParseError(r,"Expected either a class reference or attribute expression")}}else{var m=[l];while(l=e.parseElement("classRef",r)){m.push(l)}}}if(a!==true){if(r.matchToken("on")){var s=e.requireElement("expression",r)}else{var s=e.requireElement("implicitMeTarget",r)}}if(r.matchToken("for")){var p=e.requireElement("expression",r)}else if(r.matchToken("until")){var h=e.requireElement("dotOrColonPath",r,"Expected event name");if(r.matchToken("from")){var v=e.requireElement("expression",r)}}var d={classRef:l,classRef2:c,classRefs:m,attributeRef:f,on:s,time:p,evt:h,from:v,toggle:function(e,r,n,i){t.nullCheck(e,s);if(a){t.implicitLoop(e,(function(e){o("toggle",e)}))}else if(u){t.implicitLoop(e,(function(e){if(e.classList.contains(r.className)){e.classList.remove(r.className);e.classList.add(n.className)}else{e.classList.add(r.className);e.classList.remove(n.className)}}))}else if(i){t.forEach(i,(function(r){t.implicitLoop(e,(function(e){e.classList.toggle(r.className)}))}))}else{t.forEach(e,(function(e){if(e.hasAttribute(f.name)){e.removeAttribute(f.name)}else{e.setAttribute(f.name,f.value)}}))}},args:[s,p,h,v,l,c,m],op:function(e,r,n,i,a,o,s,u){if(n){return new Promise((function(i){d.toggle(r,o,s,u);setTimeout((function(){d.toggle(r,o,s,u);i(t.findNext(d,e))}),n)}))}else if(i){return new Promise((function(n){var l=a||e.me;l.addEventListener(i,(function(){d.toggle(r,o,s,u);n(t.findNext(d,e))}),{once:true});d.toggle(r,o,s,u)}))}else{this.toggle(r,o,s,u);return t.findNext(d,e)}}};return d}}));var t={display:function(r,n,i){if(i){n.style.display=i}else if(r==="toggle"){if(getComputedStyle(n).display==="none"){t.display("show",n,i)}else{t.display("hide",n,i)}}else if(r==="hide"){const t=e.runtime.getInternalData(n);if(t.originalDisplay==null){t.originalDisplay=n.style.display}n.style.display="none"}else{const t=e.runtime.getInternalData(n);if(t.originalDisplay&&t.originalDisplay!=="none"){n.style.display=t.originalDisplay}else{n.style.removeProperty("display")}}},visibility:function(e,r,n){if(n){r.style.visibility=n}else if(e==="toggle"){if(getComputedStyle(r).visibility==="hidden"){t.visibility("show",r,n)}else{t.visibility("hide",r,n)}}else if(e==="hide"){r.style.visibility="hidden"}else{r.style.visibility="visible"}},opacity:function(e,r,n){if(n){r.style.opacity=n}else if(e==="toggle"){if(getComputedStyle(r).opacity==="0"){t.opacity("show",r,n)}else{t.opacity("hide",r,n)}}else if(e==="hide"){r.style.opacity="0"}else{r.style.opacity="1"}}};var n=function(e,t,r){var n;var i=r.currentToken();if(i.value==="when"||i.value==="with"||e.commandBoundary(i)){n=e.parseElement("implicitMeTarget",r)}else{n=e.parseElement("expression",r)}return n};var i=function(e,n,i){var a=r.defaultHideShowStrategy;var o=t;if(r.hideShowStrategies){o=Object.assign(o,r.hideShowStrategies)}i=i||a||"display";var s=o[i];if(s==null){e.raiseParseError(n,"Unknown show/hide strategy : "+i)}return s};e.addCommand("hide",(function(e,t,r){if(r.matchToken("hide")){var a=n(e,t,r);var o=null;if(r.matchToken("with")){o=r.requireTokenType("IDENTIFIER","STYLE_REF").value;if(o.indexOf("*")===0){o=o.substr(1)}}var s=i(e,r,o);return{target:a,args:[a],op:function(e,r){t.nullCheck(r,a);t.implicitLoop(r,(function(e){s("hide",e)}));return t.findNext(this,e)}}}}));e.addCommand("show",(function(e,t,r){if(r.matchToken("show")){var a=n(e,t,r);var o=null;if(r.matchToken("with")){o=r.requireTokenType("IDENTIFIER","STYLE_REF").value;if(o.indexOf("*")===0){o=o.substr(1)}}var s=null;if(r.matchOpToken(":")){var u=r.consumeUntilWhitespace();r.matchTokenType("WHITESPACE");s=u.map((function(e){return e.value})).join("")}if(r.matchToken("when")){var l=e.requireElement("expression",r)}var c=i(e,r,o);return{target:a,when:l,args:[a],op:function(e,r){t.nullCheck(r,a);t.implicitLoop(r,(function(r){if(l){e.result=r;let n=t.evaluateNoPromise(l,e);if(n){c("show",r,s)}else{c("hide",r)}e.result=null}else{c("show",r,s)}}));return t.findNext(this,e)}}}}));e.addCommand("take",(function(e,t,r){if(r.matchToken("take")){var n=e.requireElement("classRef",r);if(r.matchToken("from")){var i=e.requireElement("expression",r)}else{var i=n}if(r.matchToken("for")){var a=e.requireElement("expression",r)}else{var a=e.requireElement("implicitMeTarget",r)}var o={classRef:n,from:i,forElt:a,args:[n,i,a],op:function(e,r,n,o){t.nullCheck(n,i);t.nullCheck(o,a);var s=r.className;t.implicitLoop(n,(function(e){e.classList.remove(s)}));t.implicitLoop(o,(function(e){e.classList.add(s)}));return t.findNext(this,e)}};return o}}));function a(t,r,n,i){if(n!=null){var a=t.resolveSymbol(n,r)}else{var a=r}if(a instanceof Element||a instanceof HTMLDocument){while(a.firstChild)a.removeChild(a.firstChild);a.append(e.runtime.convertValue(i,"Fragment"));t.processNode(a)}else{if(n!=null){t.setSymbol(n,r,null,i)}else{throw"Don't know how to put a value into "+typeof r}}}e.addCommand("put",(function(e,t,r){if(r.matchToken("put")){var n=e.requireElement("expression",r);var i=r.matchAnyToken("into","before","after");if(i==null&&r.matchToken("at")){r.matchToken("the");i=r.matchAnyToken("start","end");r.requireToken("of")}if(i==null){e.raiseParseError(r,"Expected one of 'into', 'before', 'at start of', 'at end of', 'after'")}var o=e.requireElement("expression",r);var s=i.value;var u=false;var l=false;var c=null;var f=null;if(o.type==="arrayIndex"&&s==="into"){u=true;f=o.prop;c=o.root}else if(o.prop&&o.root&&s==="into"){f=o.prop.value;c=o.root}else if(o.type==="symbol"&&s==="into"){l=true;f=o.name}else if(o.type==="attributeRef"&&s==="into"){var m=true;f=o.name;c=e.requireElement("implicitMeTarget",r)}else if(o.type==="styleRef"&&s==="into"){var p=true;f=o.name;c=e.requireElement("implicitMeTarget",r)}else if(o.attribute&&s==="into"){var m=o.attribute.type==="attributeRef";var p=o.attribute.type==="styleRef";f=o.attribute.name;c=o.root}else{c=o}var h={target:o,operation:s,symbolWrite:l,value:n,args:[c,f,n],op:function(e,r,n,i){if(l){a(t,e,n,i)}else{t.nullCheck(r,c);if(s==="into"){if(m){t.implicitLoop(r,(function(e){e.setAttribute(n,i)}))}else if(p){t.implicitLoop(r,(function(e){e.style[n]=i}))}else if(u){r[n]=i}else{t.implicitLoop(r,(function(e){a(t,e,n,i)}))}}else{var o=s==="before"?Element.prototype.before:s==="after"?Element.prototype.after:s==="start"?Element.prototype.prepend:s==="end"?Element.prototype.append:Element.prototype.append;t.implicitLoop(r,(function(e){o.call(e,i instanceof Node?i:t.convertValue(i,"Fragment"));if(e.parentElement){t.processNode(e.parentElement)}else{t.processNode(e)}}))}}return t.findNext(this,e)}};return h}}));function o(e,t,r){var n;if(r.matchToken("the")||r.matchToken("element")||r.matchToken("elements")||r.currentToken().type==="CLASS_REF"||r.currentToken().type==="ID_REF"||r.currentToken().op&&r.currentToken().value==="<"){e.possessivesDisabled=true;try{n=e.parseElement("expression",r)}finally{delete e.possessivesDisabled}if(r.matchOpToken("'")){r.requireToken("s")}}else if(r.currentToken().type==="IDENTIFIER"&&r.currentToken().value==="its"){var i=r.matchToken("its");n={type:"pseudopossessiveIts",token:i,name:i.value,evaluate:function(e){return t.resolveSymbol("it",e)}}}else{r.matchToken("my")||r.matchToken("me");n=e.parseElement("implicitMeTarget",r)}return n}e.addCommand("transition",(function(e,t,n){if(n.matchToken("transition")){var i=o(e,t,n);var a=[];var s=[];var u=[];var l=n.currentToken();while(!e.commandBoundary(l)&&l.value!=="over"&&l.value!=="using"){if(n.currentToken().type==="STYLE_REF"){let e=n.consumeToken();let t=e.value.substr(1);a.push({type:"styleRefValue",evaluate:function(){return t}})}else{a.push(e.requireElement("stringLike",n))}if(n.matchToken("from")){s.push(e.requireElement("expression",n))}else{s.push(null)}n.requireToken("to");if(n.matchToken("initial")){u.push({type:"initial_literal",evaluate:function(){return"initial"}})}else{u.push(e.requireElement("expression",n))}l=n.currentToken()}if(n.matchToken("over")){var c=e.requireElement("expression",n)}else if(n.matchToken("using")){var f=e.requireElement("expression",n)}var m={to:u,args:[i,a,s,u,f,c],op:function(e,n,a,o,s,u,l){t.nullCheck(n,i);var c=[];t.implicitLoop(n,(function(e){var n=new Promise((function(n,i){var c=e.style.transition;if(l){e.style.transition="all "+l+"ms ease-in"}else if(u){e.style.transition=u}else{e.style.transition=r.defaultTransition}var f=t.getInternalData(e);var m=getComputedStyle(e);var p={};for(var h=0;he.forEach((e=>x(e))))).then((()=>n((function(){a();d.processNode(document.documentElement);e.document.addEventListener("htmx:load",(function(e){d.processNode(e.detail.elt)}))}))));function n(e){if(document.readyState!=="loading"){setTimeout(e)}else{document.addEventListener("DOMContentLoaded",e)}}function i(){var e=document.querySelector('meta[name="htmx-config"]');if(e){return f(e.content)}else{return null}}function a(){var e=i();if(e){Object.assign(r,e)}}}const x=Object.assign(y,{config:r,use(e){e(x)},internals:{lexer:E,parser:T,runtime:d,Lexer:n,Tokens:i,Parser:a,Runtime:o},ElementCollection:u,addFeature:T.addFeature.bind(T),addCommand:T.addCommand.bind(T),addLeafExpression:T.addLeafExpression.bind(T),addIndirectExpression:T.addIndirectExpression.bind(T),evaluate:d.evaluate.bind(d),parse:d.parse.bind(d),processNode:d.processNode.bind(d),browserInit:k});return x}));
diff --git a/common/static/lib/js/rating-star.js b/common/static/lib/js/rating-star.js
deleted file mode 100644
index e6d27834..00000000
--- a/common/static/lib/js/rating-star.js
+++ /dev/null
@@ -1,311 +0,0 @@
-/*
- * jQuery StarRatingSvg v1.2.0
- *
- * http://github.com/nashio/star-rating-svg
- * http://nashio.github.io/star-rating-svg/demo/
- * Author: Ignacio Chavez
- * hello@ignaciochavez.com
- * Licensed under MIT
- */
-
-;(function ( $, window, document, undefined ) {
-
- 'use strict';
-
- // Create the defaults once
- var pluginName = 'starRating';
- var noop = function(){};
- var defaults = {
- totalStars: 5,
- useFullStars: false,
- starShape: 'straight',
- emptyColor: 'lightgray',
- hoverColor: 'gold',
- activeColor: 'gold',
- ratedColor: 'gold',
- useGradient: false,
- readOnly: false,
- disableAfterRate: false,
- baseUrl: false,
- starGradient: {
- start: '#FEF7CD',
- end: '#FF9511'
- },
- strokeWidth: 0,
- strokeColor: 'black',
- initialRating: 0,
- starSize: 18,
- callback: noop,
- onHover: noop,
- onLeave: noop
- };
-
- // The actual plugin constructor
- var Plugin = function( element, options ) {
- var _rating;
- this.element = element;
- this.$el = $(element);
- this.settings = $.extend( {}, defaults, options );
-
- // grab rating if defined on the element
- _rating = this.$el.data('rating') || this.settings.initialRating;
- this._state = {
- // round to the nearest half
- rating: (Math.round( _rating * 2 ) / 2).toFixed(1)
- };
-
- // create unique id for stars
- this._uid = Math.floor( Math.random() * 999 );
-
- // override gradient if not used
- if( !options.starGradient && !this.settings.useGradient ){
- this.settings.starGradient.start = this.settings.starGradient.end = this.settings.activeColor;
- }
-
- this._defaults = defaults;
- this._name = pluginName;
- this.init();
- };
-
- var methods = {
- init: function () {
- this.renderMarkup();
- this.addListeners();
- this.initRating();
- },
-
- addListeners: function(){
- if( this.settings.readOnly ){ return; }
- this.$stars.on('mouseover', this.hoverRating.bind(this));
- this.$stars.on('mouseout', this.restoreState.bind(this));
- this.$stars.on('click', this.handleRating.bind(this));
- },
-
- // apply styles to hovered stars
- hoverRating: function(e){
- var index = this.getIndex(e);
- this.paintStars(index, 'hovered');
- this.settings.onHover(index + 1, this._state.rating, this.$el);
- },
-
- // clicked on a rate, apply style and state
- handleRating: function(e){
- var index = this.getIndex(e);
- var rating = index + 1;
-
- this.applyRating(rating, this.$el);
- this.executeCallback( rating, this.$el );
-
- if(this.settings.disableAfterRate){
- this.$stars.off();
- }
- },
-
- applyRating: function(rating){
- var index = rating - 1;
- // paint selected and remove hovered color
- this.paintStars(index, 'rated');
- this._state.rating = index + 1;
- this._state.rated = true;
- },
-
- restoreState: function(e){
- var index = this.getIndex(e);
- var rating = this._state.rating || -1;
- // determine star color depending on manually rated
- var colorType = this._state.rated ? 'rated' : 'active';
- this.paintStars(rating - 1, colorType);
- this.settings.onLeave(index + 1, this._state.rating, this.$el);
- },
-
- getIndex: function(e){
- var $target = $(e.currentTarget);
- var width = $target.width();
- var side = $(e.target).attr('data-side');
-
- // hovered outside the star, calculate by pixel instead
- side = (!side) ? this.getOffsetByPixel(e, $target, width) : side;
- side = (this.settings.useFullStars) ? 'right' : side ;
-
- // get index for half or whole star
- var index = $target.index() - ((side === 'left') ? 0.5 : 0);
-
- // pointer is way to the left, rating should be none
- index = ( index < 0.5 && (e.offsetX < width / 4) ) ? -1 : index;
- return index;
- },
-
- getOffsetByPixel: function(e, $target, width){
- var leftX = e.pageX - $target.offset().left;
- return ( leftX <= (width / 2) && !this.settings.useFullStars) ? 'left' : 'right';
- },
-
- initRating: function(){
- this.paintStars(this._state.rating - 1, 'active');
- },
-
- paintStars: function(endIndex, stateClass){
- var $polygonLeft;
- var $polygonRight;
- var leftClass;
- var rightClass;
-
- $.each(this.$stars, function(index, star){
- $polygonLeft = $(star).find('[data-side="left"]');
- $polygonRight = $(star).find('[data-side="right"]');
- leftClass = rightClass = (index <= endIndex) ? stateClass : 'empty';
-
- // has another half rating, add half star
- leftClass = ( index - endIndex === 0.5 ) ? stateClass : leftClass;
-
- $polygonLeft.attr('class', 'svg-' + leftClass + '-' + this._uid);
- $polygonRight.attr('class', 'svg-' + rightClass + '-' + this._uid);
-
- }.bind(this));
- },
-
- renderMarkup: function () {
- var s = this.settings;
- var baseUrl = s.baseUrl ? location.href.split('#')[0] : '';
-
- // inject an svg manually to have control over attributes
- var star = '';
-
- // inject svg markup
- var starsMarkup = '';
- for( var i = 0; i < s.totalStars; i++){
- starsMarkup += star;
- }
- this.$el.append(starsMarkup);
- this.$stars = this.$el.find('.jq-star');
- },
-
- getVectorPath: function(id, attrs){
- return (attrs.starShape === 'rounded') ?
- this.getRoundedVectorPath(id, attrs) : this.getSpikeVectorPath(id, attrs);
- },
-
- getSpikeVectorPath: function(id, attrs){
- return '' +
- '' +
- '';
- },
-
- getRoundedVectorPath: function(id, attrs){
- var fullPoints = 'M520.9,336.5c-3.8-11.8-14.2-20.5-26.5-22.2l-140.9-20.5l-63-127.7 c-5.5-11.2-16.8-18.2-29.3-18.2c-12.5,0-23.8,7-29.3,18.2l-63,127.7L28,314.2C15.7,316,5.4,324.7,1.6,336.5S1,361.3,9.9,370 l102,99.4l-24,140.3c-2.1,12.3,2.9,24.6,13,32c5.7,4.2,12.4,6.2,19.2,6.2c5.2,0,10.5-1.2,15.2-3.8l126-66.3l126,66.2 c4.8,2.6,10,3.8,15.2,3.8c6.8,0,13.5-2.1,19.2-6.2c10.1-7.3,15.1-19.7,13-32l-24-140.3l102-99.4 C521.6,361.3,524.8,348.3,520.9,336.5z';
-
- return '';
- },
-
- getSvgDimensions: function(starShape){
- return (starShape === 'rounded') ? 'width="550px" height="500.2px" viewBox="0 146.8 550 500.2" style="enable-background:new 0 0 550 500.2;' : 'x="0px" y="0px" width="305px" height="305px" viewBox="60 -62 309 309" style="enable-background:new 64 -59 305 305;';
- },
-
- getLinearGradient: function(id, startColor, endColor, starShape){
- var height = (starShape === 'rounded') ? 500 : 250;
- return ' ';
- },
-
- executeCallback: function(rating, $el){
- var callback = this.settings.callback;
- callback(rating, $el);
- }
-
- };
-
- var publicMethods = {
-
- unload: function() {
- var _name = 'plugin_' + pluginName;
- var $el = $(this);
- var $starSet = $el.data(_name).$stars;
- $starSet.off();
- $el.removeData(_name).remove();
- },
-
- setRating: function(rating, round) {
- var _name = 'plugin_' + pluginName;
- var $el = $(this);
- var $plugin = $el.data(_name);
- if( rating > $plugin.settings.totalStars || rating < 0 ) { return; }
- if( round ){
- rating = Math.round(rating);
- }
- $plugin.applyRating(rating);
- },
-
- getRating: function() {
- var _name = 'plugin_' + pluginName;
- var $el = $(this);
- var $starSet = $el.data(_name);
- return $starSet._state.rating;
- },
-
- resize: function(newSize) {
- var _name = 'plugin_' + pluginName;
- var $el = $(this);
- var $starSet = $el.data(_name);
- var $stars = $starSet.$stars;
-
- if(newSize <= 1 || newSize > 200) {
- console.error('star size out of bounds');
- return;
- }
-
- $stars = Array.prototype.slice.call($stars);
- $stars.forEach(function(star){
- $(star).css({
- 'width': newSize + 'px',
- 'height': newSize + 'px'
- });
- });
- },
-
- setReadOnly: function(flag) {
- var _name = 'plugin_' + pluginName;
- var $el = $(this);
- var $plugin = $el.data(_name);
- if(flag === true){
- $plugin.$stars.off('mouseover mouseout click');
- } else {
- $plugin.settings.readOnly = false;
- $plugin.addListeners();
- }
- }
-
- };
-
-
- // Avoid Plugin.prototype conflicts
- $.extend(Plugin.prototype, methods);
-
- $.fn[ pluginName ] = function ( options ) {
-
- // if options is a public method
- if( !$.isPlainObject(options) ){
- if( publicMethods.hasOwnProperty(options) ){
- return publicMethods[options].apply(this, Array.prototype.slice.call(arguments, 1));
- } else {
- $.error('Method '+ options +' does not exist on ' + pluginName + '.js');
- }
- }
-
- return this.each(function() {
- // preventing against multiple instantiations
- if ( !$(this).data( 'plugin_' + pluginName ) ) {
- $(this).data( 'plugin_' + pluginName, new Plugin( this, options ) );
- }
- });
- };
-
-})( $, window, document );
diff --git a/common/static/lib/js/tag-input.js b/common/static/lib/js/tag-input.js
deleted file mode 100644
index 8070df31..00000000
--- a/common/static/lib/js/tag-input.js
+++ /dev/null
@@ -1,146 +0,0 @@
-function inputTags(configs) {
-
-
- let tagsContainer = configs.container,
- input = configs.container.querySelector('input')
-
- let _privateMethods = {
-
- init: function (configs) {
-
- // this.inspectConfigProperties(configs);
-
- let self = this,
- input_hidden = document.createElement('input');
- let name = input.getAttribute('name'),
- id = input.getAttribute('id');
- input.removeAttribute('name');
- // input.removeAttribute('id');
- input_hidden.setAttribute('type', 'hidden');
- // input_hidden.setAttribute('id', id);
- input_hidden.setAttribute('name', name);
- input.parentNode.insertBefore(input_hidden, input);
- this.input_hidden = input_hidden
-
- tagsContainer.addEventListener('click', function () {
- input.focus();
- });
-
- if (configs.tags) {
- for (let i = 0; i < configs.tags.length; i++) {
- if (configs.tags[i]) {
- this.create(configs.tags[i]);
- }
- }
- }
-
- input.addEventListener("focusout", function () {
-
- let tag_txt = this.value.trim(),
- tag_exists = false;
-
- if (self.tags_array) {
- tag_exists = Boolean(self.tags_array.indexOf(tag_txt) + 1);
- }
-
- if (tag_txt && tag_exists && !configs.allowDuplicateTags) {
- self.showDuplicate(tag_txt);
- }
- else if (tag_txt && tag_exists && configs.allowDuplicateTags) {
- self.create(tag_txt);
- }
- else if (tag_txt && !tag_exists) {
- self.create(tag_txt);
- }
- this.value = "";
-
- });
-
- input.addEventListener('keydown', function (ev) {
-
-
- if (ev.keyCode === 13 || ev.keyCode === 188 ||
- (ev.keyCode === 32 && configs.allowDuplicateTags)) { // enter || comma || space
- let event = new Event('focusout');
- input.dispatchEvent(event);
- ev.preventDefault();
- }
- else if (event.which === 8 && !input.value) { // backspace
- let tag_nodes = document.querySelectorAll('.tag-input__tag');
- if (tag_nodes.length > 0) {
- input.addEventListener('keyup', function (event) {
- if (event.which === 8) {
- let node_to_del = tag_nodes[tag_nodes.length - 1];
- node_to_del.remove();
- self.update();
- }
- });
- }
- ev.preventDefault();
- }
- });
- },
-
- create: function (tag_txt) {
-
- let tag_nodes = document.querySelectorAll('.tag-input__tag');
-
- if (!configs.maxTags || tag_nodes.length < configs.maxTags) {
- let self = this,
- span_tag = document.createElement('span'),
- input_hidden_field = self.input_hidden;
-
- span_tag.setAttribute('class', 'tag-input__tag');
- span_tag.innerText = tag_txt;
-
- let span_tag_close = document.createElement('span');
- span_tag_close.setAttribute('class', 'tag-input__close');
- span_tag.appendChild(span_tag_close);
-
- tagsContainer.insertBefore(span_tag, input_hidden_field);
-
- span_tag.childNodes[1].addEventListener('click', function () {
- self.remove(this);
- });
-
- this.update();
-
- }
- },
-
- update: function () {
-
- let tags = document.getElementsByClassName('tag-input__tag'),
- tags_arr = [];
-
- for (let i = 0; i < tags.length; i++) {
- tags_arr.push(tags[i].textContent.replace(/\s+/g, ' ').trim());
- }
- this.tags_array = tags_arr;
-
- this.input_hidden.setAttribute('value', tags_arr.join());
- },
-
- remove: function (tag) {
- configs.onTagRemove(tag.parentNode.textContent);
- tag.parentNode.remove();
- this.update();
- },
-
- showDuplicate: function (tag_value) {
- let tags = document.getElementsByClassName('tag-input__tag');
-
- for (let i = 0; i < tags.length; i++) {
- if (tags[i].textContent === tag_value) {
- tags[i].classList.add("tag-input__tag--highlight");
- window.setTimeout(function () {
- tags[i].classList.remove("tag-input__tag--highlight");
- }, configs.duplicateTime);
- }
- }
- }
- }
-
- _privateMethods.init(configs);
- // return false;
-}
diff --git a/common/templates/_header.html b/common/templates/_header.html
index 35884c1e..b1d33db2 100644
--- a/common/templates/_header.html
+++ b/common/templates/_header.html
@@ -106,15 +106,13 @@
-{% comment %}
- {% if request.user.is_authenticated and not request.user.username %}
-
+{% if request.user.is_authenticated and not request.user.mastodon_username and not request.user.username %}
+
- {% endif %}
-{% endcomment %}
+
+{% endif %}
{% if messages %}
{% for message in messages %}
diff --git a/developer/templates/oauth2_provider/application_list.html b/developer/templates/oauth2_provider/application_list.html
index 9423242a..5bfdc4af 100644
--- a/developer/templates/oauth2_provider/application_list.html
+++ b/developer/templates/oauth2_provider/application_list.html
@@ -5,7 +5,11 @@
Developer Console | {% trans "Your applications" %}
- {% if applications %}
+ {% if not request.user.mastodon_acct %}
+
+ Please connect to a Fediverse identity before creating an application.
+
+ {% elif applications %}
{% for application in applications %}
-
diff --git a/common/static/lib/css/calendar_yearview_blocks.css b/journal/static/css/calendar_yearview_blocks.css
similarity index 100%
rename from common/static/lib/css/calendar_yearview_blocks.css
rename to journal/static/css/calendar_yearview_blocks.css
diff --git a/common/static/lib/js/calendar_yearview_blocks.js b/journal/static/js/calendar_yearview_blocks.js
similarity index 100%
rename from common/static/lib/js/calendar_yearview_blocks.js
rename to journal/static/js/calendar_yearview_blocks.js
diff --git a/journal/templates/profile.html b/journal/templates/profile.html
index ccfd5448..660ffca0 100644
--- a/journal/templates/profile.html
+++ b/journal/templates/profile.html
@@ -25,8 +25,8 @@
title="{{ site_name }} - @{{ user.handler }}的评论"
href="{{ request.build_absolute_uri }}feed/reviews/">
{% include "common_libs.html" with jquery=0 v2=1 %}
-
-
+
diff --git a/social/templates/feed.html b/social/templates/feed.html
index 11150a51..a17cb8be 100644
--- a/social/templates/feed.html
+++ b/social/templates/feed.html
@@ -16,7 +16,7 @@
-
+
{% include "_header.html" with current="timeline" %}
diff --git a/users/data.py b/users/data.py
index cd046aa7..eba2dc09 100644
--- a/users/data.py
+++ b/users/data.py
@@ -158,8 +158,8 @@ def import_douban(request):
if request.method == "POST":
importer = DoubanImporter(
request.user,
- int(request.POST.get("visibility")),
- int(request.POST.get("import_mode")),
+ int(request.POST.get("visibility", 0)),
+ int(request.POST.get("import_mode", 0)),
)
if importer.import_from_file(request.FILES["file"]):
messages.add_message(request, messages.INFO, _("文件上传成功,等待后台导入。"))
diff --git a/users/static/js/followers_list.js b/users/static/js/followers_list.js
deleted file mode 100644
index 892d9f01..00000000
--- a/users/static/js/followers_list.js
+++ /dev/null
@@ -1,226 +0,0 @@
-
-$(document).ready( function() {
-
- let token = $("#oauth2Token").text();
- let mast_uri = $("#mastodonURI").text();
- let mast_domain = new URL(mast_uri);
- mast_domain = mast_domain.hostname;
- let id = $("#userMastodonID").text();
- let nextUrl = null;
- let requesting = false;
-
- let userInfoSpinner = $("#spinner").clone().removeAttr("hidden");
- let followersSpinner = $("#spinner").clone().removeAttr("hidden");
- let followingSpinner = $("#spinner").clone().removeAttr("hidden");
- let mainSpinner = $("#spinner").clone().removeAttr("hidden");
-
- $(".mast-user").first().hide();
-
- $(".mast-user-list").append(mainSpinner);
- $("#userInfoCard").append(userInfoSpinner);
- $("#followings h5").after(followingSpinner);
- $("#followers h5").after(followersSpinner);
- $(".mast-following-more").hide();
- $(".mast-followers-more").hide();
-
- getUserInfo(
- id,
- mast_uri,
- token,
- function (userData) {
- let userName;
- if (userData.display_name) {
- userName = translateEmojis(userData.display_name, userData.emojis, true);
- } else {
- userName = userData.username;
- }
- $("#userInfoCard .mast-avatar").attr("src", userData.avatar);
- $("#userInfoCard .mast-displayname").html(userName);
- $("#userInfoCard .mast-brief").text($("
"+userData.note.replace(/\
").text());
- $("#userInfoCard .mast-brief").html($("#userInfoCard .mast-brief").html().replace(/\n/g,'
'));
- $(userInfoSpinner).remove();
- }
- );
-
- getFollowers(
- id,
- mast_uri,
- token,
- function(userList, nextPage) {
- let subUserList = null;
- if (userList.length == 0) {
- $(".mast-followers").hide();
- $(".mast-followers").before('
暂无
');
- } else {
- if (userList.length > 4){
- subUserList = userList.slice(0, 4);
- $(".mast-followers-more").show();
- } else {
- subUserList = userList;
- }
- let template = $(".mast-followers li").clone();
- $(".mast-followers").html("");
- subUserList.forEach(data => {
- temp = $(template).clone();
- temp.find("img").attr("src", data.avatar);
- if (data.display_name) {
- temp.find(".mast-displayname").html(translateEmojis(data.display_name, data.emojis));
- } else {
- temp.find(".mast-displayname").text(data.username);
- }
- let url;
- if (data.acct.includes('@')) {
- url = $("#userPageURL").text().replace('0', data.acct);
- } else {
- url = $("#userPageURL").text().replace('0', data.acct + '@' + mast_domain);
- }
- temp.find("a").attr('href', url);
- $(".mast-followers").append(temp);
- });
- }
- $(followersSpinner).remove();
- // main
- let template = $(".mast-user").clone().show();
-
- userList.forEach(data => {
- temp = $(template).clone();
- temp.find("img").attr("src", data.avatar);
- if (data.display_name) {
- temp.find(".mast-displayname").html(translateEmojis(data.display_name, data.emojis));
- } else {
- temp.find(".mast-displayname").text(data.username);
- }
- let url;
- if (data.acct.includes('@')) {
- url = $("#userPageURL").text().replace('0', data.acct);
- } else {
- url = $("#userPageURL").text().replace('0', data.acct + '@' + mast_domain);
- }
- temp.find("a").attr('href', url);
- temp.find(".mast-brief").text(data.note.replace(/(<([^>]+)>)/ig,""));
- $(".mast-user").last().after(temp);
- });
-
- mainSpinner.hide();
- nextUrl = nextPage;
- }
- );
-
- getFollowing(
- id,
- mast_uri,
- token,
- function(userList, request) {
- if (userList.length == 0) {
- $(".mast-following").hide();
- $(".mast-following").before('
暂无
');
- } else {
- if (userList.length > 4){
- userList = userList.slice(0, 4);
- $(".mast-following-more").show();
- }
- let template = $(".mast-following li").clone();
- $(".mast-following").html("");
- userList.forEach(data => {
- temp = $(template).clone()
- temp.find("img").attr("src", data.avatar);
- if (data.display_name) {
- temp.find(".mast-displayname").html(translateEmojis(data.display_name, data.emojis));
- } else {
- temp.find(".mast-displayname").text(data.username);
- }
- let url;
- if (data.acct.includes('@')) {
- url = $("#userPageURL").text().replace('0', data.acct);
- } else {
- url = $("#userPageURL").text().replace('0', data.acct + '@' + mast_domain);
- }
- temp.find("a").attr('href', url);
- $(".mast-following").append(temp);
- });
- }
- $(followingSpinner).remove();
-
- }
- );
-
- $(document.body).on('touchmove', () => {
- let scrollPosition = $(window).scrollTop();
- // test if scoll to bottom
- // mobile phone has extra offset
- if (scrollPosition + $(window).height() > $(document).height() - 70) {
- onScroll();
- }
- });
-
-
- $(window).on("scroll", function () {
- let scrollPosition = $(window).scrollTop();
- // test if scoll to bottom
- if (scrollPosition + $(window).height() > $(document).height() - 0.5) {
- onScroll();
- }
- });
-
-
- function onScroll() {
- if (!requesting && nextUrl) {
- // acquire lock
- requesting = true;
- mainSpinner.show();
- $.ajax({
- url: nextUrl,
- method: 'GET',
- data: {
- 'limit': NUMBER_PER_REQUEST,
- },
- headers: {
- 'Authorization': 'Bearer ' + token,
- },
- success: function (userList, status, request) {
- if (userList.length == 0) {
- mainSpinner.hide();
- return;
- }
- let template = $(".mast-user").first().clone().show();
- let newUrlFlag = false;
- request.getResponseHeader('link').split(',').forEach(link => {
- if (link.includes('next')) {
- let regex = /<(.*?)>/;
- nextUrl = link.match(regex)[1];
- newUrlFlag = true;
- }
- });
- if (!newUrlFlag) {
- nextUrl = null;
- }
- userList.forEach(data => {
- temp = $(template).clone()
- temp.find("img").attr("src", data.avatar);
- if (data.display_name) {
- temp.find(".mast-displayname").html(translateEmojis(data.display_name, data.emojis));
- } else {
- temp.find(".mast-displayname").text(data.username);
- }
- let url;
- if (data.acct.includes('@')) {
- url = $("#userPageURL").text().replace('0', data.acct);
- } else {
- url = $("#userPageURL").text().replace('0', data.acct + '@' + mast_domain);
- }
- temp.find("a").attr('href', url);
- temp.find(".mast-brief").text(data.note.replace(/(<([^>]+)>)/ig, ""));
- // console.log($(temp).html())
- $(".mast-user").last().after(temp);
- });
- mainSpinner.hide();
- // release lock
- // console.log(userList[userList.length-1].username)
- // console.log(nextUrl)
- requesting = false;
- },
- });
- }
- }
-
-});
diff --git a/users/static/js/following_list.js b/users/static/js/following_list.js
deleted file mode 100644
index b3ea138f..00000000
--- a/users/static/js/following_list.js
+++ /dev/null
@@ -1,226 +0,0 @@
-
-$(document).ready( function() {
-
- let token = $("#oauth2Token").text();
- let mast_uri = $("#mastodonURI").text();
- let mast_domain = new URL(mast_uri);
- mast_domain = mast_domain.hostname;
- let id = $("#userMastodonID").text();
- let nextUrl = null;
- let requesting = false;
-
- let userInfoSpinner = $("#spinner").clone().removeAttr("hidden");
- let followersSpinner = $("#spinner").clone().removeAttr("hidden");
- let followingSpinner = $("#spinner").clone().removeAttr("hidden");
- let mainSpinner = $("#spinner").clone().removeAttr("hidden");
-
- $(".mast-user").first().hide();
-
- $(".mast-user-list").append(mainSpinner);
- $("#userInfoCard").append(userInfoSpinner);
- $("#followings h5").after(followingSpinner);
- $("#followers h5").after(followersSpinner);
- $(".mast-following-more").hide();
- $(".mast-followers-more").hide();
-
- getUserInfo(
- id,
- mast_uri,
- token,
- function (userData) {
- let userName;
- if (userData.display_name) {
- userName = translateEmojis(userData.display_name, userData.emojis, true);
- } else {
- userName = userData.username;
- }
- $("#userInfoCard .mast-avatar").attr("src", userData.avatar);
- $("#userInfoCard .mast-displayname").html(userName);
- $("#userInfoCard .mast-brief").text($("
"+userData.note.replace(/\
").text());
- $("#userInfoCard .mast-brief").html($("#userInfoCard .mast-brief").html().replace(/\n/g,'
'));
- $(userInfoSpinner).remove();
- }
- );
-
- getFollowers(
- id,
- mast_uri,
- token,
- function (userList, request) {
- if (userList.length == 0) {
- $(".mast-followers").hide();
- $(".mast-followers").before('
暂无
');
- } else {
- if (userList.length > 4) {
- userList = userList.slice(0, 4);
- $(".mast-followers-more").show();
- }
- let template = $(".mast-followers li").clone();
- $(".mast-followers").html("");
- userList.forEach(data => {
- temp = $(template).clone();
- temp.find("img").attr("src", data.avatar);
- if (data.display_name) {
- temp.find(".mast-displayname").html(translateEmojis(data.display_name, data.emojis));
- } else {
- temp.find(".mast-displayname").text(data.username);
- }
- let url;
- if (data.acct.includes('@')) {
- url = $("#userPageURL").text().replace('0', data.acct);
- } else {
- url = $("#userPageURL").text().replace('0', data.acct + '@' + mast_domain);
- }
- temp.find("a").attr('href', url);
- $(".mast-followers").append(temp);
- });
- }
- $(followersSpinner).remove();
- }
- );
-
- getFollowing(
- id,
- mast_uri,
- token,
- function(userList, nextPage) {
- // aside
- let subUserList = null;
- if (userList.length == 0) {
- $(".mast-following").hide();
- $(".mast-following").before('
暂无
');
- } else {
- if (userList.length > 4){
- subUserList = userList.slice(0, 4);
- $(".mast-following-more").show();
- } else {
- subUserList = userList;
- }
- let template = $(".mast-following li").clone();
- $(".mast-following").html("");
- subUserList.forEach(data => {
- temp = $(template).clone()
- temp.find("img").attr("src", data.avatar);
- if (data.display_name) {
- temp.find(".mast-displayname").html(translateEmojis(data.display_name, data.emojis));
- } else {
- temp.find(".mast-displayname").text(data.username);
- }
- let url;
- if (data.acct.includes('@')) {
- url = $("#userPageURL").text().replace('0', data.acct);
- } else {
- url = $("#userPageURL").text().replace('0', data.acct + '@' + mast_domain);
- }
- temp.find("a").attr('href', url);
- $(".mast-following").append(temp);
- });
- }
- $(followingSpinner).remove();
-
- // main
- let template = $(".mast-user").clone().show();
- userList.forEach(data => {
- temp = $(template).clone()
- temp.find("img").attr("src", data.avatar);
- if (data.display_name) {
- temp.find(".mast-displayname").html(translateEmojis(data.display_name, data.emojis));
- } else {
- temp.find(".mast-displayname").text(data.username);
- }
- let url;
- if (data.acct.includes('@')) {
- url = $("#userPageURL").text().replace('0', data.acct);
- } else {
- url = $("#userPageURL").text().replace('0', data.acct + '@' + mast_domain);
- }
- temp.find("a").attr('href', url);
- temp.find(".mast-brief").text(data.note.replace(/(<([^>]+)>)/ig,""));
- $(".mast-user").last().after(temp);
- });
-
- mainSpinner.hide();
- nextUrl = nextPage;
- }
- );
-
- $(document.body).on('touchmove', () => {
- let scrollPosition = $(window).scrollTop();
- // test if scoll to bottom
- // mobile phone has extra offset
- if (scrollPosition + $(window).height() > $(document).height() - 70) {
- onScroll();
- }
- });
-
-
- $(window).on("scroll", function() {
- let scrollPosition = $(window).scrollTop();
- // test if scoll to bottom
- if (scrollPosition + $(window).height() > $(document).height() - 0.5) {
- onScroll();
- }
- });
-
- function onScroll() {
- if (!requesting && nextUrl) {
- // acquire lock
- requesting = true;
- mainSpinner.show();
- $.ajax({
- url: nextUrl,
- method: 'GET',
- data: {
- 'limit': NUMBER_PER_REQUEST,
- },
- headers: {
- 'Authorization': 'Bearer ' + token,
- },
- success: function (userList, status, request) {
- if (userList.length == 0) {
- mainSpinner.hide();
- return;
- }
- let template = $(".mast-user").first().clone().show();
- let newUrlFlag = false;
- request.getResponseHeader('link').split(',').forEach(link => {
- if (link.includes('next')) {
- let regex = /<(.*?)>/;
- nextUrl = link.match(regex)[1];
- newUrlFlag = true;
- }
- });
- if (!newUrlFlag) {
- nextUrl = null;
- }
- // console.log(userList.length)
- userList.forEach(data => {
- temp = $(template).clone()
- temp.find("img").attr("src", data.avatar);
- if (data.display_name) {
- temp.find(".mast-displayname").html(translateEmojis(data.display_name, data.emojis));
- } else {
- temp.find(".mast-displayname").text(data.username);
- }
- let url;
- if (data.acct.includes('@')) {
- url = $("#userPageURL").text().replace('0', data.acct);
- } else {
- url = $("#userPageURL").text().replace('0', data.acct + '@' + mast_domain);
- }
- temp.find("a").attr('href', url);
- temp.find(".mast-brief").text(data.note.replace(/(<([^>]+)>)/ig, ""));
- // console.log($(temp).html())
- $(".mast-user").last().after(temp);
- });
- mainSpinner.hide();
- // console.log(userList[userList.length-1].username)
- // console.log(nextUrl)
- // release lock
- requesting = false;
- },
- });
- }
- }
-
-});
diff --git a/users/templates/users/account.html b/users/templates/users/account.html
index e94dacf4..d600fc40 100644
--- a/users/templates/users/account.html
+++ b/users/templates/users/account.html
@@ -53,18 +53,24 @@