Update content of files

This commit is contained in:
GitHub Action 2022-12-03 11:07:58 +00:00
parent fb6ed275d6
commit ab12341539
3 changed files with 804 additions and 67 deletions

View file

@ -45,6 +45,7 @@
--table-text-color: #8c9aa9;
--header-height: 48px;
--def-border-radius: 8px;
--min-border-radius: 3px;
--popup-border-radius: 12px;
--bg-rgb: 26, 32, 38;
--bg-color: rgb(var(--bg-rgb));
@ -60,6 +61,13 @@
--footer-bg-color: #111417;
--tooltip-bg-color: #2d3c4c;
--tooltip-color: #fff;
--header-tab-color-rgb: 203, 215, 229;
--header-tab-color-active: #fff;
--header-tab-accent-color: #248bda;
}
html.header-tabs {
--header-height: 90px;
}
body {
@ -467,6 +475,65 @@ i.icon {
background-image: var(--image-url-change-account);
margin-right: 10px;
}
.tm-header-tabs {
display: flex;
position: absolute;
left: 0;
right: 0;
top: 48px;
padding: 0 17px;
}
.tm-header-tab,
.tm-section-tab {
font-size: 14px;
line-height: 18px;
font-weight: bold;
padding: 12px 0;
color: rgba(var(--header-tab-color-rgb), .7);
transition: color var(--def-transition);
position: relative;
}
a.tm-header-tab:hover,
a.tm-header-tab:focus,
a.tm-section-tab:hover,
a.tm-section-tab:focus {
text-decoration: none;
color: rgba(var(--header-tab-color-rgb), .9);
}
.tm-header-tab.tab-active,
a.tm-header-tab.tab-active:hover,
a.tm-header-tab.tab-active:focus,
.tm-section-tab.tab-active,
a.tm-section-tab.tab-active:hover,
a.tm-section-tab.tab-active:focus {
color: var(--header-tab-color-active);
}
.tm-header-tab.tab-active:after,
.tm-section-tab.tab-active:after {
content: '';
display: block;
position: absolute;
height: 4px;
left: 0;
right: 0;
bottom: 0;
background-color: var(--header-tab-accent-color);
border-radius: 3px 3px 0 0;
}
.tm-header-tab + .tm-header-tab,
.tm-section-tab + .tm-section-tab {
margin-left: 26px;
}
.tm-header-tab-label-new {
font-size: 11px;
line-height: 14px;
font-weight: bold;
padding: 1px 5px;
margin-left: 4px;
background-color: var(--header-tab-accent-color);
color: #fff;
border-radius: 4px;
}
.tm-header-menu-button {
padding: 15px;
cursor: pointer;
@ -671,6 +738,9 @@ a.tm-menu-link:focus {
.icon-menu-bids:before {
background-image: var(--image-url-menu-bids);
}
.icon-menu-numbers:before {
background-image: var(--image-url-menu-numbers);
}
.icon-menu-convert:before {
background-image: var(--image-url-menu-convert);
}
@ -883,11 +953,34 @@ a.tm-menu-link:focus {
margin: 4px 0 0;
}
.icon-link-more:after {
width: 12px;
height: 23px;
width: 9px;
height: 17px;
background-image: var(--image-url-link-more);
transform: scale(0.75);
transform-origin: 0 0;
}
.tm-main-intro-link {
display: inline-block;
font-size: 12px;
line-height: 19px;
border-radius: 20px;
background-color: #12171c;
color: var(--text-color);
padding: 7px 15px;
margin: 12px 0 -6px;
}
.tm-main-intro-link:hover,
.tm-main-intro-link:focus {
text-decoration: none;
color: var(--text-color);
}
.tm-main-intro-link .icon-link-more {
color: var(--accent-color);
}
.tm-main-intro-link .icon-link-more:hover {
text-decoration: underline;
}
.tm-main-intro-link .icon-link-more:after {
width: 8px;
height: 18px;
}
.tm-header-search-form {
@ -918,11 +1011,34 @@ a.tm-menu-link:focus {
color: var(--field-color);
text-overflow: ellipsis;
}
.tm-main-search-form .tm-search-input {
.tm-main-search-form .tm-search-input,
.tm-main-search-form .tm-search-prefix {
font-size: 14px;
line-height: 18px;
padding: 12px 42px 12px 48px;
}
.tm-main-search-form .tm-search-prefix {
position: absolute;
padding-right: 0;
color: var(--field-color);
}
.tm-main-search-form .tm-search-prefix + .tm-search-input {
padding-left: 86px;
}
.tm-search-field-hint {
font-size: 13px;
line-height: 20px;
margin: 10px 20px -8px;
}
.tm-search-field-hint .icon-ton {
letter-spacing: 13px;
}
.tm-search-field-hint .icon-ton:before {
width: 13px;
height: 18px;
margin-left: 0;
margin-right: -13px;
}
.tm-search-loading,
.tm-search-clear {
position: absolute;
@ -1110,6 +1226,22 @@ a.tm-menu-link:focus {
margin-top: -9px;
}
.tm-section-tabs {
display: flex;
margin: -3px 0 15px;
padding: 0 6px;
}
.tm-section-tab {
padding: 8px 0;
}
.tm-section-tab.tab-active:after {
height: 3px;
border-radius: 2px;
}
.tm-section-tab + .tm-section-tab {
margin-left: 20px;
}
.tm-form-subheader {
font-size: 18px;
line-height: 28px;
@ -1198,6 +1330,10 @@ a.tm-menu-link:focus {
flex-direction: row;
justify-content: start;
}
.tm-table .table-cell-oneline.table-cell-wide {
padding-top: 12px;
padding-bottom: 12px;
}
.tm-table td:first-child .table-cell,
.tm-table thead > tr > th:first-child {
padding-left: 16px;
@ -1325,6 +1461,12 @@ a.tm-menu-link:focus {
color: #ff5863;
}
.tm-nowrap {
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
}
.tm-wallet {
display: inline-flex;
white-space: nowrap;
@ -1402,6 +1544,40 @@ a.tm-wallet:hover .tail {
linear-gradient(90deg, rgba(var(--cur-bg-rgb), 0) 0px, rgba(var(--cur-bg-rgb), 1) 0.35em, rgba(var(--cur-bg-rgb), 0) 0.35em),
linear-gradient(270deg, rgba(var(--cur-bg-rgb), 0) 0px, rgba(var(--cur-bg-rgb), 1) 0.35em, rgba(var(--cur-bg-rgb), 0) 0.35em);
}
.wallet-new .tm-wallet .middle:before {
padding: 0;
margin: 0;
}
.wallet-new .tm-wallet .middle {
width: 0;
}
.wallet-new .tm-wallet .middle:before {
display: inline-block;
content: '...';
color: transparent;
width: 2em;
transform: translateX(-50%);
background: rgba(var(--cur-bg-rgb), .8);
font-size: 0.6em;
line-height: 0.7em;
border-radius: 1em;
vertical-align: -0.2em;
margin-right: -2em;
box-shadow: 0 0 5px 1px rgb(var(--cur-bg-rgb));
}
.wallet-new .tm-wallet .middle:after {
display: inline-block;
position: relative;
content: '...';
padding: 0 0.5em;
background: linear-gradient(90deg, rgba(var(--cur-bg-rgb), 0) 0%, rgba(var(--cur-bg-rgb), 1) 50%, rgba(var(--cur-bg-rgb), 0) 100%);
transform: translateX(-50%);
}
.tm-wallet .short {
text-overflow: ellipsis;
overflow: hidden;
flex-basis: 100%;
}
.tm-web3-address {
display: inline-flex;
@ -1531,6 +1707,15 @@ a.tm-table-action-link:hover {
line-height: var(--line-height);
padding: 5px 16px 10px;
}
.tm-bid-info-text:empty {
display: none;
}
.tm-list-item-hint {
--line-height: 17px;
font-size: 13px;
line-height: var(--line-height);
padding: 0 16px 10px;
}
.tm-section-buttons {
display: flex;
flex-direction: row;
@ -1748,7 +1933,7 @@ a.tm-table-action-link:hover {
vertical-align: top;
background-position: 0 0;
background-repeat: no-repeat;
background-image: var(--list-item-selected-icon);
background-image: var(--image-url-list-item-selected-icon);
width: 25px;
height: 25px;
top: 0;
@ -1795,6 +1980,99 @@ a.tm-table-action-link:hover {
overflow: hidden;
}
.tm-number-codes {
max-width: 348px;
margin: 0 auto;
}
.tm-number-prev-codes {
margin: 20px 0 0;
}
.tm-number-code-field {
position: relative;
font-size: 30px;
line-height: 42px;
font-weight: bold;
padding: 12px 20px;
background-color: var(--table-header-bg-color);
border-radius: var(--def-border-radius);
color: var(--field-color);
text-align: center;
}
.tm-number-code-field[data-copy] {
cursor: pointer;
}
.tm-nocopy {
-webkit-user-select: none;
user-select: none;
}
.tm-number-code-field > .tm-number-code-copy {
position: absolute;
top: 0;
right: 0;
font-size: 14px;
line-height: 18px;
font-weight: bold;
padding: 24px 19px;
}
.tm-number-code-field > .tm-number-code-copy:before {
width: 13px;
height: 18px;
margin-right: 7px;
background-image: var(--image-url-copy-icon);
}
.table-cell-value > .tm-number-code-copy {
display: inline-block;
cursor: pointer;
}
.table-cell-value > .tm-number-code-copy:after {
width: 13px;
height: 18px;
margin-left: 7px;
background-image: var(--image-url-copy-text-icon);
}
.tm-number-code-date {
font-size: 12px;
line-height: 20px;
text-align: center;
margin: 8px 0 0;
}
.tm-number-code-link {
font-size: 14px;
line-height: 20px;
margin-top: 24px;
text-align: center;
}
.tm-number-code-button {
margin-top: 24px;
}
.tm-number-code-spoiler b.point {
position: absolute;
display: inline-block;
left: 0;
top: 0;
width: 4px;
height: 4px;
margin: -2px;
border-radius: 50%;
background-color: currentColor;
pointer-events: none;
}
.tm-number-code-spoiler.blured {
filter: blur(10px);
}
.tm-number-code-spoiler:before {
content: attr(data-pattern);
color: transparent;
}
.tm-number-code-spoiler.blured:before {
color: inherit;
}
.qr-random-popup .tm-qr-code-label {
overflow: visible;
}
.qr-random-popup .tm-number-code-spoiler.blured {
filter: blur(7px);
}
@ -2254,6 +2532,9 @@ a.tm-table-action-link:hover {
:root {
--header-height: 56px;
}
html.header-tabs {
--header-height: 56px;
}
.btn {
font-size: 15px;
@ -2285,6 +2566,13 @@ a.tm-table-action-link:hover {
.tm-header-actions {
display: flex;
}
.tm-header-tabs {
position: static;
padding: 0;
}
.tm-header-tab {
padding: 19px 0;
}
.tm-dropdown .dropdown-toggle.btn {
padding: 9px 14px;
@ -2372,8 +2660,20 @@ a.tm-table-action-link:hover {
margin-top: 8px;
}
.icon-link-more:after {
transform: scale(1);
width: 12px;
height: 23px;
}
.tm-main-intro-link {
font-size: 14px;
line-height: 19px;
padding: 10px 20px;
margin: 20px 0 -8px;
}
.tm-main-intro-link .icon-link-more:after {
width: 10px;
height: 19px;
}
.tm-header-search-form {
max-width: 274px;
margin-left: 0;
@ -2390,11 +2690,18 @@ a.tm-table-action-link:hover {
.tm-search-field:before {
margin: 8px 12px;
}
.tm-main-search-form .tm-search-input {
.tm-main-search-form .tm-search-input,
.tm-main-search-form .tm-search-prefix {
font-size: 17px;
line-height: 24px;
padding: 14px 54px 16px 66px;
}
.tm-main-search-form .tm-search-prefix {
padding-right: 0;
}
.tm-main-search-form .tm-search-prefix + .tm-search-input {
padding-left: 112px;
}
.tm-main-search-form .tm-search-field:before {
margin: 14px 22px 16px;
}
@ -2451,6 +2758,14 @@ a.tm-table-action-link:hover {
margin-top: -9px;
}
.tm-section-tabs {
margin: -6px 0 23px;
padding: 0 13px;
}
.tm-section-tab {
padding: 10px 0;
}
.tm-table-empty {
padding: 30px 20px;
}
@ -2510,6 +2825,10 @@ a.tm-table-action-link:hover {
.tm-table .table-cell-oneline {
padding-top: 10px;
}
.tm-table .table-cell-oneline.table-cell-wide {
padding-top: 16px;
padding-bottom: 16px;
}
.tm-table .table-cell-oneline .table-cell-desc {
font-size: 14px;
}
@ -2590,10 +2909,13 @@ a.tm-table-action-link:hover {
}
.tm-bid-info-text {
font-size: 13px;
--line-height: 19px;
padding: 2px 20px 10px;
}
.tm-list-item-hint {
--line-height: 19px;
padding: 0 20px 10px;
}
.tm-under-table-buttons {
flex-direction: row;
@ -2666,6 +2988,8 @@ a.tm-table-action-link:hover {
--image-url-menu-bids: url('data:image/svg+xml,%3Csvg%20height%3D%2272%22%20viewBox%3D%220%200%2072%2072%22%20width%3D%2272%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cg%20fill%3D%22none%22%20fill-rule%3D%22evenodd%22%20stroke%3D%22%23fff%22%3E%3Ccircle%20cx%3D%2236%22%20cy%3D%2236%22%20r%3D%2231%22%20stroke-width%3D%223.6%22%2F%3E%3Cpath%20d%3D%22m22.73%2026h26.52c.57%200%201.04.47%201.04%201.04%200%20.18-.05.35-.13.5l-12.56%2023.05c-.55%201.01-1.82%201.38-2.83.83-.36-.2-.65-.5-.85-.86l-12.12-23.03c-.26-.51-.07-1.14.44-1.41.15-.08.32-.12.49-.12zm13.27%2024.89v-24.89%22%20stroke-width%3D%223.4%22%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E');
--image-url-menu-numbers: url('data:image/svg+xml,%3Csvg%20height%3D%2272%22%20viewBox%3D%220%200%2072%2072%22%20width%3D%2272%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cg%20fill%3D%22none%22%20fill-rule%3D%22evenodd%22%20stroke%3D%22%23fff%22%20stroke-width%3D%223.6%22%3E%3Cpath%20d%3D%22m17.16%2015.2c1.76%200%203.38.65%204.6%201.74%201.23%201.09%202.07%202.62%202.28%204.37l.75%206.43c.23%202.02-.43%204.01-1.8%205.48l-1.59%202.81c3.46%206.26%209.51%2011.59%2015.82%2014.99l2.97-1.98c1.48-1.36%203.94-1.89%205.97-1.65l6.05%201.01c1.9.4%203.31%201.39%204.26%202.95.83%201.34%201.3%203.17%201.33%205.52%200%201.97-.82%203.77-2.14%205.03-1.31%201.27-3.11%202.01-5.07%201.89-11.37-.71-21.61-5.59-29.17-13.14-7.57-7.55-12.47-17.75-13.18-29.1-.13-2.1.11-3.6.8-4.59.7-1.02%201.85-1.76%204.07-1.76z%22%20fill-rule%3D%22nonzero%22%2F%3E%3Crect%20height%3D%2214%22%20rx%3D%223.33%22%20width%3D%2220%22%20x%3D%2240%22%20y%3D%2219%22%2F%3E%3Cpath%20d%3D%22m44.2%2018.86v-5.06c0-3.2%202.6-5.8%205.8-5.8s5.8%202.6%205.8%205.8v5.06%22%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E');
--image-url-menu-convert: url('data:image/svg+xml,%3Csvg%20height%3D%2272%22%20viewBox%3D%220%200%2072%2072%22%20width%3D%2272%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cg%20fill%3D%22none%22%20fill-rule%3D%22evenodd%22%20stroke%3D%22%23fff%22%20stroke-width%3D%223.6%22%3E%3Ccircle%20cx%3D%2235.027778%22%20cy%3D%2234%22%20r%3D%2212.152778%22%2F%3E%3Ccircle%20cx%3D%2235.027778%22%20cy%3D%2234%22%20r%3D%2212.152778%22%2F%3E%3Cg%20stroke-linecap%3D%22round%22%3E%3Cpath%20d%3D%22m47.18%2034.49c-.65%207.45%201.62%2011.34%206.81%2011.66%205.18.33%207.77-3.72%207.77-12.15%200-14.77-11.97-26.74-26.73-26.74-14.77%200-26.74%2011.97-26.74%2026.74s11.97%2026.74%2026.74%2026.74h18.18%22%2F%3E%3Cpath%20d%3D%22m47%2053%208.54%207.12c.21.17.24.49.06.7-.02.02-.04.04-.06.06l-8.54%207.12%22%2F%3E%3C%2Fg%3E%3C%2Fg%3E%3C%2Fsvg%3E');
--image-url-menu-disconnect: url('data:image/svg+xml,%3Csvg%20height%3D%2272%22%20viewBox%3D%220%200%2072%2072%22%20width%3D%2272%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22m45.5%2023.5v-4c0-3.31-2.69-6-6-6h-22c-3.31%200-6%202.69-6%206v32c0%203.31%202.69%206%206%206h22c3.31%200%206-2.69%206-6v-5m-18-11h39.5zm29.5-11.5%2010.79%2010.79c.39.39.39%201.03%200%201.42l-10.79%2010.79%22%20fill%3D%22none%22%20stroke%3D%22%23fff%22%20stroke-linecap%3D%22round%22%20stroke-width%3D%223.6%22%2F%3E%3C%2Fsvg%3E');
@ -2702,9 +3026,13 @@ a.tm-table-action-link:hover {
--image-url-wallet-icon: url('data:image/svg+xml,%3Csvg%20height%3D%2219%22%20viewBox%3D%220%200%2018%2019%22%20width%3D%2218%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22m12.5%2011c.39%200%20.74-.15%201.04-.46.31-.3.46-.66.46-1.06%200-.39-.15-.74-.46-1.03-.3-.3-.65-.45-1.04-.45s-.74.15-1.04.45c-.31.29-.46.64-.46%201.03%200%20.4.15.76.46%201.06.3.31.65.46%201.04.46zm-2.45%202.5c-.47%200-.85-.24-1.13-.52s-.42-.65-.42-1.1v-4.73c0-.48.14-.85.42-1.12s.66-.53%201.13-.53h5.39c.48%200%20.86.26%201.14.53s.42.64.42%201.12v4.73c0%20.45-.14.82-.42%201.1s-.66.52-1.14.52zm-9.05%201v-10c0-1.38%201.12-2.5%202.5-2.5h11.38c.33%200%20.63.13.88.39.25.25.38.54.38.86v.75h-6.35c-.81%200-1.49.64-2.02%201.17-.53.52-.77%201.18-.77%201.98v4.73c0%20.79.24%201.45.77%201.97.53.53%201.21%201.15%202.02%201.15h6.35v.75c0%20.33-.13.63-.38.88s-.55.37-.88.37h-11.38c-1.38%200-2.5-1.12-2.5-2.5z%22%20fill%3D%22%234cb0fd%22%2F%3E%3C%2Fsvg%3E');
--image-url-copy-icon: url('data:image/svg+xml,%3Csvg%20height%3D%2218%22%20viewBox%3D%220%200%2013%2018%22%20width%3D%2213%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cg%20fill%3D%22none%22%20fill-rule%3D%22evenodd%22%20stroke%3D%22%23fff%22%20stroke-width%3D%221.4%22%3E%3Crect%20height%3D%2211.5%22%20rx%3D%221.5%22%20width%3D%228.48%22%20x%3D%223.52%22%20y%3D%224.5%22%2F%3E%3Cpath%20d%3D%22m1%2012.25v-7.5c0-1.52%201.23-2.75%202.75-2.75h4.35%22%20stroke-linecap%3D%22round%22%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E');
--image-url-copy-text-icon: url('data:image/svg+xml,%3Csvg%20height%3D%2218%22%20viewBox%3D%220%200%2013%2018%22%20width%3D%2213%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cg%20fill%3D%22none%22%20fill-rule%3D%22evenodd%22%20stroke%3D%22%234db2ff%22%20stroke-width%3D%221.4%22%3E%3Crect%20height%3D%2211.5%22%20rx%3D%221.5%22%20width%3D%228.48%22%20x%3D%223.52%22%20y%3D%224.5%22%2F%3E%3Cpath%20d%3D%22m1%2012.25v-7.5c0-1.52%201.23-2.75%202.75-2.75h4.35%22%20stroke-linecap%3D%22round%22%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E');
--image-url-tooltip-bottom: url('data:image/svg+xml,%3Csvg%20height%3D%226%22%20viewBox%3D%220%200%2015%206%22%20width%3D%2215%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22m0%200h15c-.22%200-.47.1-.66.29l-4.71%204.64c-1.17%201.15-3.05%201.15-4.21%200l-4.72-4.64c-.19-.19-.44-.29-.7-.29z%22%20fill%3D%22%232d3c4c%22%20fill-rule%3D%22evenodd%22%2F%3E%3C%2Fsvg%3E');
--image-url-row-arrow: url('data:image/svg+xml,%3Csvg%20height%3D%2217%22%20viewBox%3D%220%200%2011%2017%22%20width%3D%2211%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22m3%2014%205.15-5.11c.19-.2.19-.52%200-.71l-5.15-5.18%22%20fill%3D%22none%22%20stroke%3D%22%235b6975%22%20stroke-linecap%3D%22round%22%20stroke-width%3D%222%22%2F%3E%3C%2Fsvg%3E');
--list-item-selected-icon: url('data:image/svg+xml,%3Csvg%20height%3D%2225%22%20viewBox%3D%220%200%2025%2025%22%20width%3D%2225%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22m6%2013.44%204.3%204.3c.2.2.52.2.71%200l8.74-8.74%22%20fill%3D%22none%22%20stroke%3D%22%234db2ff%22%20stroke-linecap%3D%22round%22%20stroke-width%3D%222.2%22%2F%3E%3C%2Fsvg%3E');
--image-url-list-item-selected-icon: url('data:image/svg+xml,%3Csvg%20height%3D%2225%22%20viewBox%3D%220%200%2025%2025%22%20width%3D%2225%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22m6%2013.44%204.3%204.3c.2.2.52.2.71%200l8.74-8.74%22%20fill%3D%22none%22%20stroke%3D%22%234db2ff%22%20stroke-linecap%3D%22round%22%20stroke-width%3D%222.2%22%2F%3E%3C%2Fsvg%3E');
}

View file

@ -1,5 +1,8 @@
var Main = {
CHECK_PERIOD: 400,
UPDATE_PERIOD: 1200,
FORCE_UPDATE_PERIOD: 5000,
init: function() {
Aj.onLoad(function(state) {
var cont = Aj.ajContainer;
@ -14,7 +17,7 @@ var Main = {
$(cont).on('click.curPage', '.js-howitworks', Main.eHowitworks);
$(cont).on('click.curPage', '.logout-link', Login.logOut);
$(cont).on('click.curPage', '.ton-logout-link', Login.tonLogOut);
$(cont).on('click.curPage', '.js-copy-code', Main.copyText);
$(cont).on('click.curPage', '.js-copy-code', Main.copyCode);
$(cont).on('click.curPage', '.js-main-search-dd-item', Main.eMainSearchDDSelected);
state.$headerMenu = $('.js-header-menu');
state.$unavailPopup = $('.js-unavailable-popup');
@ -369,8 +372,7 @@ var Main = {
location.href = href;
}
},
copyText: function() {
var text = $(this).attr('data-copy');
copyText: function(text) {
var $text = $('<textarea readonly>').css('position', 'fixed').css('left', '-9999px');
$text.val(text).appendTo('body');
var selected = document.getSelection().rangeCount > 0 ? document.getSelection().getRangeAt(0) : false;
@ -382,6 +384,37 @@ var Main = {
document.getSelection().addRange(selected);
}
},
openApp: function(app_url) {
if (Aj.state.appUseIframe) {
var $frame = $('<iframe>').css('position', 'fixed').css('left', '-9999px');
$frame.appendTo('body');
var pageHidden = false, hideCallback = function () {
$(window).off('pagehide blur', hideCallback);
pageHidden = true;
};
$(window).on('pagehide blur', hideCallback);
$frame.attr('src', app_url);
if (!Aj.state.appUseIframeOnce) {
setTimeout(function() {
if (!pageHidden) {
window.location = app_url;
}
}, 2000);
}
} else {
setTimeout(function() {
window.location = app_url;
}, 100);
}
},
copyCode: function() {
var code = $(this).attr('data-copy');
var app_url = $(this).attr('data-app-url');
Main.copyText(code);
if (app_url) {
Main.openApp(app_url);
}
},
eMainSearchInput: function(e) {
if (!Aj.state.quickSearch) {
return;
@ -397,6 +430,7 @@ var Main = {
eMainSearchDDSelected: function(e) {
e.preventDefault();
e.stopImmediatePropagation();
$(this).closeDropdown();
var field = $(this).attr('data-field');
var value = $(this).attr('data-value');
var $form = Aj.state.$mainSearchForm;
@ -416,7 +450,8 @@ var Main = {
if (result.html) {
$('.js-search-results', Aj.ajContainer).html(result.html);
Main.updateTime();
Aj.setLocation(result.url, true);
var loc = Aj.location(), path = loc.pathname + loc.search;
Aj.setLocation(result.url, path != '/');
}
$('.js-main-recent-bids').toggleClass('hide', !result.show_recent_bids);
},
@ -441,16 +476,20 @@ var Main = {
searchSubmit: function() {
var $form = Aj.state.$mainSearchForm;
var cache = Aj.state.mainSearchCache;
var type = $form.field('type').value();
var query = $form.field('query').value();
var filter = $form.field('filter').value();
var sort = $form.field('sort').value();
var cache_key = 'q='+query+'&f='+filter+'&s='+sort;
Aj.state.$mainSearchField.addClass('loading').removeClass('play').redraw().addClass('play');
Aj.showProgress();
Aj.apiRequest('searchAuctions', {
type: type,
query: query,
filter: filter,
sort: sort
}, function(result) {
Aj.hideProgress();
if (result.ok) {
cache[cache_key] = result;
Main.updateResults(result);
@ -514,7 +553,6 @@ var Login = {
};
var Auction = {
UPDATE_PERIOD: 1200,
init: function() {
Aj.onLoad(function(state) {
var cont = Aj.ajContainer;
@ -529,7 +567,8 @@ var Auction = {
state.$bidForm = $('.js-place-bid-form');
Main.initForm(state.$bidForm);
state.needUpdate = true;
state.updStateTo = setTimeout(Auction.updateState, Auction.UPDATE_PERIOD);
state.updLastReq = +Date.now();
state.updStateTo = setTimeout(Auction.updateState, Main.UPDATE_PERIOD);
Assets.init();
Account.init();
});
@ -540,20 +579,30 @@ var Auction = {
});
},
updateState: function() {
Aj.apiRequest('updateAuction', {
username: Aj.state.username,
lt: Aj.state.auctionLastLt
}, function(result) {
if (result.html) {
$('.js-main-content').html(result.html);
}
if (result.lt) {
Aj.state.auctionLastLt = result.lt;
}
var now = +Date.now();
if (document.hasFocus() ||
Aj.state.updLastReq && (now - Aj.state.updLastReq) > Main.FORCE_UPDATE_PERIOD) {
Aj.state.updLastReq = now;
Aj.apiRequest('updateAuction', {
type: Aj.state.type,
username: Aj.state.username,
lt: Aj.state.auctionLastLt
}, function(result) {
if (result.html) {
$('.js-main-content').html(result.html);
}
if (result.lt) {
Aj.state.auctionLastLt = result.lt;
}
if (Aj.state.needUpdate) {
Aj.state.updStateTo = setTimeout(Auction.updateState, Main.UPDATE_PERIOD);
}
});
} else {
if (Aj.state.needUpdate) {
Aj.state.updStateTo = setTimeout(Auction.updateState, Auction.UPDATE_PERIOD);
Aj.state.updStateTo = setTimeout(Auction.updateState, Main.CHECK_PERIOD);
}
});
}
},
ePlaceBid: function(e) {
e.stopImmediatePropagation();
@ -569,7 +618,9 @@ var Auction = {
ePlaceBidSubmit: function(e) {
e.preventDefault();
var $form = $(this);
var type = Aj.state.type;
var username = Aj.state.username;
var item_title = Aj.state.itemTitle;
var amount = Main.amountFieldValue($form, 'bid_value');
if (amount === false) {
$form.field('bid_value').focus();
@ -580,6 +631,7 @@ var Auction = {
request: {
method: 'getBidLink',
params: {
type: type,
username: username,
bid: amount
}
@ -588,7 +640,7 @@ var Auction = {
description: l('WEB_POPUP_QR_PLACE_BID_TEXT', {
amount: '<span class="icon-before icon-ton-text">' + amount + '</span>'
}),
qr_label: '@' + username,
qr_label: item_title,
tk_label: l('WEB_POPUP_QR_PLACE_BID_TK_BUTTON'),
terms_label: l('WEB_POPUP_QR_PLACE_BID_TERMS'),
onConfirm: function(by_server) {
@ -600,23 +652,26 @@ var Auction = {
},
eBuyNow: function(e) {
e.preventDefault();
var type = Aj.state.type;
var username = Aj.state.username;
var item_title = Aj.state.itemTitle;
var amount = $(this).attr('data-bid-amount');
QR.showPopup({
request: {
method: 'getBidLink',
params: {
type: type,
username: username,
bid: amount
}
},
title: l('WEB_POPUP_QR_BUY_NOW_HEADER', {
username: '<span class="accent-color">@' + username + '</span>'
username: '<span class="accent-color">' + item_title + '</span>'
}),
description: l('WEB_POPUP_QR_BUY_NOW_TEXT', {
amount: '<span class="icon-before icon-ton-text">' + amount + '</span>'
}),
qr_label: '@' + username,
qr_label: item_title,
tk_label: l('WEB_POPUP_QR_BUY_NOW_TK_BUTTON'),
terms_label: l('WEB_POPUP_QR_PLACE_BID_TERMS'),
onConfirm: function(by_server) {
@ -631,9 +686,9 @@ var Auction = {
return false;
}
e.preventDefault();
var username = Aj.state.username;
Aj.apiRequest('subscribe', {
username: username
type: Aj.state.type,
username: Aj.state.username
}, function(result) {
if (result.error) {
return showAlert(result.error);
@ -646,9 +701,9 @@ var Auction = {
return false;
}
e.preventDefault();
var username = Aj.state.username;
Aj.apiRequest('unsubscribe', {
username: username
type: Aj.state.type,
username: Aj.state.username
}, function(result) {
if (result.error) {
return showAlert(result.error);
@ -658,11 +713,11 @@ var Auction = {
},
eLoadMoreOrders: function(e) {
e.preventDefault();
var username = Aj.state.username;
var $table = $(this).closest('table');
var offset_id = $(this).attr('data-next-offset');
Aj.apiRequest('getOrdersHistory', {
username: username,
type: Aj.state.type,
username: Aj.state.username,
offset_id: offset_id
}, function(result) {
if (result.error) {
@ -674,11 +729,11 @@ var Auction = {
},
eLoadMoreOwners: function(e) {
e.preventDefault();
var username = Aj.state.username;
var $table = $(this).closest('table');
var offset_id = $(this).attr('data-next-offset');
Aj.apiRequest('getOwnersHistory', {
username: username,
type: Aj.state.type,
username: Aj.state.username,
offset_id: offset_id
}, function(result) {
if (result.error) {
@ -695,6 +750,7 @@ var Assets = {
Aj.onLoad(function(state) {
$(document).on('click.curPage', '.js-assign-btn', Assets.eAssignToTelegram);
$(document).on('submit.curPage', '.js-assign-form', Assets.eAssignSubmit);
$(document).on('click.curPage', '.js-get-code-btn', Assets.eGetCode);
$(document).on('click.curPage', '.js-put-to-auction-btn', Assets.ePutToAuction);
$(document).on('submit.curPage', '.js-put-to-auction-form', Assets.ePutToAuctionSubmit);
$(document).on('click.curPage', '.js-cancel-auction-btn', Assets.eCancelAuction);
@ -720,6 +776,14 @@ var Assets = {
eTableRowSelHovered: function(e) {
$(this).closest('.tm-row-selectable').toggleClass('noselect', e.type == 'mouseover');
},
eGetCode: function(e) {
e.stopImmediatePropagation();
e.preventDefault();
var href = $(this).attr('data-href');
if (href) {
Aj.location(href);
}
},
eAssignToTelegram: function(e) {
e.stopImmediatePropagation();
e.preventDefault();
@ -778,20 +842,42 @@ var Assets = {
$(this).closeDropdown();
var $actions = $(this).closest('.js-actions');
var username = $actions.attr('data-username');
var item_title = $actions.attr('data-item-title');
var def_bid = $actions.attr('data-def-bid');
$('.js-username', Aj.state.$putToAuctionPopup).html('@' + username);
openPopup(Aj.state.$putToAuctionPopup, {
onOpen: function() {
Aj.state.$putToAuctionForm.reset();
Aj.state.$putToAuctionForm.field('username').value(username);
Aj.state.$putToAuctionForm.field('min_bid_value').value(def_bid).trigger('input').focusAndSelect();
}
});
var doPutToAuction = function() {
$('.js-username', Aj.state.$putToAuctionPopup).html(item_title);
openPopup(Aj.state.$putToAuctionPopup, {
onOpen: function() {
Aj.state.$putToAuctionForm.reset();
Aj.state.$putToAuctionForm.field('username').value(username);
Aj.state.$putToAuctionForm.data('item_title', item_title);
Aj.state.$putToAuctionForm.field('min_bid_value').value(def_bid).trigger('input').focusAndSelect();
}
});
};
if ($actions.attr('data-need-check')) {
Aj.apiRequest('canSellItem', {
type: Aj.state.type,
username: username,
auction: true
}, function(result) {
if (result.confirm_message) {
showConfirm(result.confirm_message, function() {
doPutToAuction();
}, result.confirm_button);
} else {
doPutToAuction();
}
});
} else {
doPutToAuction();
}
},
ePutToAuctionSubmit: function(e) {
e.preventDefault();
var $form = $(this);
var username = $form.field('username').value();
var item_title = Aj.state.$putToAuctionForm.data('item_title');
var min_amount = Main.amountFieldValue($form, 'min_bid_value');
var max_amount = Main.amountFieldValue($form, 'max_price_value');
closePopup(Aj.state.$putToAuctionPopup);
@ -799,6 +885,7 @@ var Assets = {
request: {
method: 'getStartAuctionLink',
params: {
type: Aj.state.type,
username: username,
min_amount: min_amount,
max_amount: max_amount
@ -806,7 +893,7 @@ var Assets = {
},
title: l('WEB_POPUP_QR_START_AUCTION_HEADER'),
description: l('WEB_POPUP_QR_START_AUCTION_TEXT'),
qr_label: '@' + username,
qr_label: item_title,
tk_label: l('WEB_POPUP_QR_START_AUCTION_TK_BUTTON'),
terms_label: l('WEB_POPUP_QR_PROCEED_TERMS'),
onConfirm: function(by_server) {
@ -815,7 +902,7 @@ var Assets = {
showAlert(l('WEB_START_AUCTION_SENT'));
});
}
Aj.location('/username/' + username);
Aj.location(Aj.state.typeUrl + username);
}
});
},
@ -825,16 +912,18 @@ var Assets = {
$(this).closeDropdown();
var $actions = $(this).closest('.js-actions');
var username = $actions.attr('data-username');
var item_title = $actions.attr('data-item-title');
QR.showPopup({
request: {
method: 'getCancelAuctionLink',
params: {
type: Aj.state.type,
username: username
}
},
title: l('WEB_POPUP_QR_STOP_AUCTION_HEADER'),
description: l('WEB_POPUP_QR_STOP_AUCTION_TEXT'),
qr_label: '@' + username,
qr_label: item_title,
tk_label: l('WEB_POPUP_QR_STOP_AUCTION_TK_BUTTON'),
terms_label: l('WEB_POPUP_QR_PROCEED_TERMS'),
onConfirm: function(by_server) {
@ -843,7 +932,7 @@ var Assets = {
showAlert(l('WEB_STOP_AUCTION_SENT'));
});
}
Aj.location('/username/' + username);
Aj.location(Aj.state.typeUrl + username);
}
});
},
@ -853,48 +942,218 @@ var Assets = {
$(this).closeDropdown();
var $actions = $(this).closest('.js-actions');
var username = $actions.attr('data-username');
var item_title = $actions.attr('data-item-title');
var def_bid = $actions.attr('data-def-bid');
$('.js-username', Aj.state.$sellUsernamePopup).html('@'+username);
openPopup(Aj.state.$sellUsernamePopup, {
onOpen: function() {
Aj.state.$sellUsernameForm.reset();
Aj.state.$sellUsernameForm.field('username').value(username);
Aj.state.$sellUsernameForm.field('sell_value').value(def_bid).trigger('input').focusAndSelect();
}
});
var doSellUsername = function() {
$('.js-username', Aj.state.$sellUsernamePopup).html(item_title);
openPopup(Aj.state.$sellUsernamePopup, {
onOpen: function() {
Aj.state.$sellUsernameForm.reset();
Aj.state.$sellUsernameForm.field('username').value(username);
Aj.state.$sellUsernameForm.data('item_title', item_title);
Aj.state.$sellUsernameForm.field('sell_value').value(def_bid).trigger('input').focusAndSelect();
}
});
};
if ($actions.attr('data-need-check')) {
Aj.apiRequest('canSellItem', {
type: Aj.state.type,
username: username,
auction: false
}, function(result) {
if (result.confirm_message) {
showConfirm(result.confirm_message, function() {
doSellUsername();
}, result.confirm_button);
} else {
doSellUsername();
}
});
} else {
doSellUsername();
}
},
eSellUsernameSubmit: function(e) {
e.preventDefault();
var $form = $(this);
var username = $form.field('username').value();
var item_title = Aj.state.$sellUsernameForm.data('item_title');
var sell_amount = Main.amountFieldValue($form, 'sell_value');
closePopup(Aj.state.$sellUsernamePopup);
QR.showPopup({
request: {
method: 'getStartAuctionLink',
params: {
type: Aj.state.type,
username: username,
min_amount: sell_amount,
max_amount: sell_amount
}
},
title: l('WEB_POPUP_QR_SELL_USERNAME_HEADER'),
description: l('WEB_POPUP_QR_SELL_USERNAME_TEXT'),
qr_label: '@' + username,
tk_label: l('WEB_POPUP_QR_SELL_USERNAME_TK_BUTTON'),
title: l('WEB_POPUP_QR_SELL_HEADER'),
description: l('WEB_POPUP_QR_SELL_TEXT'),
qr_label: item_title,
tk_label: l('WEB_POPUP_QR_SELL_TK_BUTTON'),
terms_label: l('WEB_POPUP_QR_PROCEED_TERMS'),
onConfirm: function(by_server) {
if (by_server) {
$(Aj.ajContainer).one('page:load', function() {
showAlert(l('WEB_SELL_USERNAME_SENT'));
showAlert(l('WEB_SELL_SENT'));
});
}
Aj.location('/username/' + username);
Aj.location(Aj.state.typeUrl + username);
}
});
}
};
var Random = {
init: function() {
Aj.onLoad(function(state) {
var cont = Aj.ajContainer;
$(cont).on('click.curPage', '.js-buy-random-btn', Random.eBuyRandom);
$(cont).on('click.curPage', '.js-buy-more-random-btn', Random.eBuyMoreRandom);
state.updLastReq = +Date.now();
if (state.needUpdate) {
state.updStateTo = setTimeout(Random.updateState, Main.UPDATE_PERIOD);
}
$('.js-spoiler', cont).each(function() {
SimpleSpoiler.init(this);
}).removeClass('blured');
});
Aj.onUnload(function(state) {
var cont = Aj.ajContainer;
clearTimeout(state.updStateTo);
state.needUpdate = false;
$('.js-spoiler', cont).each(function() {
SimpleSpoiler.destroy(this);
});
});
},
updateContent: function(html) {
var $main = $('.js-main-content');
$('.js-spoiler', $main).each(function() {
SimpleSpoiler.destroy(this);
});
$('.js-main-content').html(html);
$('.js-spoiler', $main).each(function() {
SimpleSpoiler.init(this);
}).removeClass('blured');
},
updateState: function() {
var now = +Date.now();
if (document.hasFocus() ||
Aj.state.updLastReq && (now - Aj.state.updLastReq) > Main.FORCE_UPDATE_PERIOD) {
Aj.state.updLastReq = now;
Aj.apiRequest('updateRandom', {}, function(result) {
if (result.html) {
Random.updateContent(result.html);
}
if (result.done && Aj.state.$sentPopup) {
closePopup(Aj.state.$sentPopup);
}
if (Aj.state.needUpdate &&
result.need_update) {
Aj.state.updStateTo = setTimeout(Random.updateState, Main.UPDATE_PERIOD);
}
});
} else {
if (Aj.state.needUpdate) {
Aj.state.updStateTo = setTimeout(Random.updateState, Main.CHECK_PERIOD);
}
}
},
eBuyRandom: function(e) {
e.preventDefault();
var item_title = Aj.state.itemTitle;
var amount = Aj.state.price;
QR.showPopup({
request: {
method: 'getRandomNumberLink',
params: {}
},
popup_class: 'qr-random-popup',
title: l('WEB_POPUP_QR_BUY_RANDOM_HEADER'),
description: l('WEB_POPUP_QR_BUY_RANDOM_TEXT', {
amount: '<span class="icon-before icon-ton-text">' + amount + '</span>',
address: Aj.state.curWallet
}),
qr_label: item_title,
tk_label: l('WEB_POPUP_QR_BUY_RANDOM_TK_BUTTON'),
terms_label: l('WEB_POPUP_QR_PROCEED_TERMS'),
onConfirm: function(by_server) {
if (by_server) {
Aj.state.$sentPopup = showAlert(l('WEB_BUY_RANDOM_SENT'));
}
},
onOpen: function() {
$('.js-spoiler', this).each(function() {
SimpleSpoiler.init(this);
}).removeClass('blured');
},
onClose: function() {
$('.js-spoiler', this).each(function() {
SimpleSpoiler.destroy(this);
});
}
});
Aj.state.needUpdate = true;
clearTimeout(Aj.state.updStateTo);
Aj.state.updStateTo = setTimeout(Random.updateState, Main.UPDATE_PERIOD);
},
eBuyMoreRandom: function(e) {
e.preventDefault();
e.stopImmediatePropagation();
Aj.apiRequest('repeatRandom', {}, function(result) {
Aj.state.needUpdate = false;
if (result.html) {
Random.updateContent(result.html);
}
});
}
};
var LoginCodes = {
init: function() {
Aj.onLoad(function(state) {
state.needUpdate = true;
state.updLastReq = +Date.now();
state.updStateTo = setTimeout(LoginCodes.updateState, Main.UPDATE_PERIOD);
});
Aj.onUnload(function(state) {
clearTimeout(state.updStateTo);
state.needUpdate = false;
});
},
updateState: function() {
var now = +Date.now();
if (document.hasFocus() ||
Aj.state.updLastReq && (now - Aj.state.updLastReq) > Main.FORCE_UPDATE_PERIOD) {
Aj.state.updLastReq = now;
Aj.apiRequest('updateLoginCodes', {
number: Aj.state.number,
lt: Aj.state.lastLt,
from_app: Aj.state.fromApp
}, function(result) {
if (result.html) {
$('.js-main-content').html(result.html);
}
if (result.lt) {
Aj.state.lastLt = result.lt;
}
if (Aj.state.needUpdate) {
Aj.state.updStateTo = setTimeout(LoginCodes.updateState, Main.UPDATE_PERIOD);
}
});
} else {
if (Aj.state.needUpdate) {
Aj.state.updStateTo = setTimeout(LoginCodes.updateState, Main.CHECK_PERIOD);
}
}
}
};
var Account = {
init: function() {
Aj.onLoad(function(state) {
@ -1106,6 +1365,7 @@ var MyBids = {
var $table = $(this).closest('table');
var offset_id = $(this).attr('data-next-offset');
Aj.apiRequest('getBidsHistory', {
type: Aj.state.type || '',
offset_id: offset_id
}, function(result) {
if (result.error) {
@ -1117,11 +1377,37 @@ var MyBids = {
}
};
var Sessions = {
init: function() {
Aj.onLoad(function(state) {
$(document).on('click.curPage', '.js-terminate-btn', Sessions.eTerminate);
});
},
eTerminate: function(e) {
e.stopImmediatePropagation();
e.preventDefault();
var $actions = $(this).closest('.js-actions');
var $table_row = $(this).closest('tr');
var session_id = $actions.attr('data-session-id');
Aj.apiRequest('tonTerminateSession', {
session_id: session_id
}, function(result) {
if (result.error) {
return showAlert(result.error);
}
if (result.ok) {
$table_row.remove();
}
});
}
};
var QR = {
showPopup: function(options) {
options = $.extend({
title: 'Scan QR Code',
description: null,
popup_class: null,
hint: null,
qr_label: null,
tk_label: null,
@ -1139,7 +1425,7 @@ var QR = {
var hint = options.hint ? '<p class="popup-text popup-hint-text">' + options.hint + '</p>' : '';
var tk_button = options.tk_label && (is_android || is_ios) ? '<p class="tm-qr-code-or">' + l('WEB_POPUP_QR_OR_BUTTON') + '</p><button class="btn btn-primary btn-block btn-tonkeeper js-tonkeeper-btn" data-inactive-label="' + l('WEB_WAITING', 'Waiting...') + '"><span class="tm-button-label">' + options.tk_label + '</span></button>' : '';
var terms_text = options.terms_label ? '<p class="popup-footer-text">' + options.terms_label + '</p>' : '';
var $popup = $('<div class="popup-container hide qr-code-popup-container qr-inactive" data-close-outside="popup-body"><div class="popup"><div class="popup-body"><section><h2>' + options.title + '</h2><p class="popup-text">' + options.description + '</p><div class="tm-qr-code"><div class="tm-qr-code-image"></div>' + qr_label + '</div>' + tk_button + hint + terms_text + '</section></div></div></div>');
var $popup = $('<div class="popup-container hide qr-code-popup-container' + (options.popup_class ? ' ' + options.popup_class : '') + ' qr-inactive" data-close-outside="popup-body"><div class="popup"><div class="popup-body"><section><h2>' + options.title + '</h2><p class="popup-text">' + options.description + '</p><div class="tm-qr-code"><div class="tm-qr-code-image"></div>' + qr_label + '</div>' + tk_button + hint + terms_text + '</section></div></div></div>');
var $qrCode = $('.tm-qr-code-image', $popup);
var $tonkeeperBtn = $('.js-tonkeeper-btn', $popup);
var $confirmedBtn = $('.js-confirmed-btn', $popup);
@ -1265,7 +1551,10 @@ var QR = {
$popup.remove();
}, 500);
});
openPopup($popup);
openPopup($popup, {
onOpen: options.onOpen,
onClose: options.onClose,
});
return $popup;
},
getUrl: function(link, callback) {
@ -1300,3 +1589,122 @@ var QR = {
});
}
};
var SimpleSpoiler = {
init: function(el) {
el.style.position = 'relative';
var el_w = el.offsetWidth;
var el_h = el.offsetHeight;
var max_d = 5;
var fps = 30;
var lsec = 0.6;
var count = 300;
console.log(count)
var points = [];
for (var i = 0; i < count; i++) {
var b = document.createElement('b');
b.className = 'point';
var point = {
b: b,
mx: el_w,
my: el_h,
md: max_d,
cnt: count,
fps: fps,
lsec: lsec,
t: SimpleSpoiler.random(0, fps * lsec)
};
SimpleSpoiler.resetPoint(point);
SimpleSpoiler.updatePoint(point);
el.appendChild(b);
points.push(point);
}
var userAgent = window.navigator.userAgent;
var isSafari = !!window.safari ||
!!(userAgent && (/\b(iPad|iPhone|iPod)\b/.test(userAgent) || (!!userAgent.match('Safari') && !userAgent.match('Chrome'))));
var isRAF = isSafari;
var interval = 1000 / fps;
var last_render = +(new Date);
var doRedraw = function() {
var now = +Date.now();
if (now - last_render >= interval) {
for (var i = 0; i < spoiler.points.length; i++) {
var point = spoiler.points[i];
if (++point.t >= fps * lsec) {
point.t = 0;
SimpleSpoiler.resetPoint(point);
}
SimpleSpoiler.updatePoint(point);
}
last_render = now;
}
if (isRAF) {
spoiler.raf = requestAnimationFrame(doRedraw)
} else {
var delay = interval - (now - last_render);
spoiler.to = setTimeout(doRedraw, delay);
}
};
var spoiler = {
points: points
};
if (isRAF) {
spoiler.raf = requestAnimationFrame(doRedraw)
} else {
spoiler.to = setTimeout(doRedraw, 20);
}
el._spoiler = spoiler;
},
destroy: function(el) {
var spoiler = el._spoiler;
if (spoiler.raf) {
cancelAnimationFrame(spoiler.raf);
}
if (spoiler.to) {
clearTimeout(spoiler.to);
}
for (var i = 0; i < spoiler.points.length; i++) {
var point = spoiler.points[i];
var b = point.b;
b.parentNode && b.parentNode.removeChild(b);
}
},
random: function(x, y) {
return x + Math.floor(Math.random() * (y + 1 - x));
},
resetPoint: function(point) {
var v = SimpleSpoiler.generateVector(point.cnt);
point.x = SimpleSpoiler.random(point.md, point.mx - point.md);
point.y = SimpleSpoiler.random(point.md, point.my - point.md);
point.dx = v.dx;
point.dy = v.dy;
point.s = SimpleSpoiler.random(60, 80) * point.my / 3600;
},
updatePoint: function(point) {
var b = point.b;
var t = point.t;
var d = point.fps * point.lsec / 3;
var k = 360 / point.lsec / point.fps
var x = point.x + k * t * point.dx;
var y = point.y + k * t * point.dy;
b.style.transform = 'translate(' + x + 'px, ' + y + 'px) scale(' + point.s + ')';
b.style.opacity = (t < d ? (t / d) : (t < d*2 ? 1 : (d*3 - t) / d)) * 0.95;
},
generateVector: function(count) {
var speedMax = 8;
var speedMin = 4;
var lifetime = 600;
var value = SimpleSpoiler.random(0, 2 * count + 2);
var negative = (value < count + 1);
var mod = (negative ? value : (value - count - 1));
var speed = speedMin + (((speedMax - speedMin) * mod) / count);
var max = Math.ceil(speedMax * lifetime);
var k = speed / lifetime;
var x = (SimpleSpoiler.random(0, 2 * max + 1) - max) / max;
var y = Math.sqrt(1 - x * x) * (negative ? -1 : 1);
return {
dx: k * x,
dy: k * y,
};
}
};

View file

@ -364,6 +364,7 @@ function ajInit(options) {
if (result.s) {
$.extend(Aj.state, result.s);
}
document.documentElement.className = result.rc || '';
if (result._dlog) {
$('#dlog').html(result._dlog);
}