diff --git a/res/arrows.png b/res/arrows.png new file mode 100644 index 0000000..a7c75bd Binary files /dev/null and b/res/arrows.png differ diff --git a/res/menu_icons.png b/res/menu_icons.png index b798a89..73846cb 100755 Binary files a/res/menu_icons.png and b/res/menu_icons.png differ diff --git a/res/mobile.js b/res/mobile.js new file mode 100644 index 0000000..4d8089d --- /dev/null +++ b/res/mobile.js @@ -0,0 +1,107 @@ +$(document).on('click', '.show_more_info_profile_link', (e) => { + $('.show_more_info_profile_content').toggleClass('active') + $('.show_more_info_profile_link').html([tr('mobile_user_info_show_details'), tr('mobile_user_info_hide')][Number($('.show_more_info_profile_content').hasClass('active'))]) +}) + +u(document).on("click", ".post-like-button-natural", function(e) { + e.preventDefault(); + + const thisBtn = u(e.target).closest('a'); + const link = thisBtn.attr("href"); + const heart = thisBtn.find('.like'); + const counter = thisBtn.find('.likeCnt'); + const likes = counter.text() === "" ? 0 : counter.text(); + const isLiked = Number(thisBtn.attr("data-liked")) == 1; + + fetch(link, { + method: 'POST' + }) + + thisBtn.attr("data-liked", isLiked ? '1' : '0') + + if(!isLiked) { + heart.attr("id", 'liked'); + } else { + heart.attr("id", ''); + } + + counter.text(parseInt(likes) + (isLiked ? -1 : 1)); + if (counter.text() === "0") { + counter.text(""); + } + + return false; +}) + +u(document).on('click', '#search_options_toggler', (e) => { + u('.search_options').toggleClass('hidden') + u('#search_options_toggler_arrow').toggleClass('shown') +}) + +u(document).on('click', '#__mobile_reset_search', (e) => { + u('.main .header_search_inputbt .sr_input').nodes[0].value = '' + u(`.page_search_options input[type='text']`).nodes.forEach(inp => { + inp.value = '' + }) + + u(`.page_search_options input[type='checkbox']`).nodes.forEach(chk => { + chk.checked = false + }) + + u(`.page_search_options input[type='radio']`).nodes.forEach(rad => { + if(rad.dataset.default) { + rad.checked = true + return + } + + rad.checked = false + }) + + u(`.page_search_options select`).nodes.forEach(sel => { + sel.value = sel.dataset.default + }) +}) + +function escapeHtml(text) { + var map = { + '&': '&', + '<': '<', + '>': '>', + '"': '"', + "'": ''' + }; + + return text.replace(/[&<>"']/g, function(m) { return map[m]; }); +} + +// maybe сделать скрипт с подобными функциями чтобы не приходилось копипастить? +function highlightText(searchText, container_selector, selectors = []) { + const container = u(container_selector) + const regexp = new RegExp(`(${searchText})`, 'gi') + + function highlightNode(node) { + if(node.nodeType == 3) { + let newNode = escapeHtml(node.nodeValue) + newNode = newNode.replace(regexp, (match, ...args) => { + return `${escapeHtml(match)}` + }) + + const tempDiv = document.createElement('div') + tempDiv.innerHTML = newNode + + while(tempDiv.firstChild) { + node.parentNode.insertBefore(tempDiv.firstChild, node) + } + node.parentNode.removeChild(node) + } else if(node.nodeType === 1 && node.tagName !== 'SCRIPT' && node.tagName !== 'BR' && node.tagName !== 'STYLE') { + Array.from(node.childNodes).forEach(highlightNode); + } + } + + selectors.forEach(selector => { + elements = container.find(selector) + if(!elements || elements.length < 1) return; + + elements.nodes.forEach(highlightNode) + }) +} diff --git a/res/mobile_audios.js b/res/mobile_audios.js index 907266a..ecc94ae 100644 --- a/res/mobile_audios.js +++ b/res/mobile_audios.js @@ -45,14 +45,14 @@ function initPlayer(id, keys, url, length) { } }; - player.querySelector(".tracks").style.display = "flex" - const dashPlayer = dashjs.MediaPlayer().create(); dashPlayer.initialize(audio, url, false); dashPlayer.setProtectionData(protData); playButton.addEventListener("click", (event) => { if(audio.paused) { + u('.tracks').attr('style', 'display:none;') + player.querySelector(".tracks").style.display = "flex" document.querySelectorAll('audio').forEach(el => el.pause()); audio.play() } else { @@ -84,7 +84,7 @@ function initPlayer(id, keys, url, length) { nextPlayer = player.nextElementSibling } - if(!nextPlayer) return + if(!nextPlayer || nextPlayer.classList.contains('withdrawn')) return initPlayer(nextPlayer.dataset.id, JSON.parse(nextPlayer.dataset.keys), @@ -122,7 +122,7 @@ function initPlayer(id, keys, url, length) { player.querySelector(".lengthTrack .usedPart").style.width = `${ ps}%`; }) } catch(e) { - console.log("Что-то ёбнулось") + console.log("Что-то сломалось.") } // тяжело без jquery @@ -195,4 +195,36 @@ $(document).on("click", "#bookmarkPlaylist, #unbookmarkPlaylist", (e) => { fastError(response.flash.message) } }) -}) \ No newline at end of file +}) + +u(document).on('click', '.litePlayer .add-icon, .litePlayer .del-icon', (e) => { + const target = u(e.target) + const act = target.hasClass('add-icon') ? 'add' : 'remove' + const id = Number(target.attr('data-id')) + $.ajax({ + type: 'POST', + url: `/audio${id}/action?act=${act}`, + data: { + hash: u("meta[name=csrf]").attr("value"), + }, + beforeSend: () => { + target.addClass('lagged') + }, + success: (response) => { + target.removeClass('lagged') + if(response.success) { + if(act == 'add') { + target.addClass('del-icon') + target.removeClass('add-icon') + } else { + target.removeClass('del-icon') + target.addClass('add-icon') + } + + return + } + + console.error(response) + } + }) +}) diff --git a/res/podrobnee.js b/res/podrobnee.js deleted file mode 100755 index 2587f0c..0000000 --- a/res/podrobnee.js +++ /dev/null @@ -1,90 +0,0 @@ -let p_bt = null -let p_content = null -if(document.querySelector('.podrobnee') != null) { - - p_bt = document.querySelector('.podrobnee'); - p_content = document.querySelector('.podrobnee_content'); - - p_bt.addEventListener('click', function(){ - let text = ["Показать подробнее", "Скрыть"]; - p_bt.innerText = text[Number(p_bt.innerText === text[0])] - p_content.classList.toggle('active'); - }); -} - -/*u(".post-like-button").on("click", function(e) { - e.preventDefault(); - - var thisBtn = u(this).first(); - var link = u(this).attr("href"); - var heart = u(".like", thisBtn); - var counter = u(".likeCnt", thisBtn); - var likes = counter.text() === "" ? 0 : counter.text(); - var isLiked = heart.attr("id") === 'liked'; - - ky(link); - heart.attr("id", isLiked ? '' : 'liked'); - counter.text(parseInt(likes) + (isLiked ? -1 : 1)); - if (counter.text() === "0") { - counter.text(""); - } - - return false; -});*/ - -function mobileRepost(postId) { - let el = document.getElementById("post"+postId+"_actions") - let hash = document.querySelector("meta[name=csrf]").getAttribute("value"); - - if(document.querySelector("#post"+postId+"_actions #mobile_repost"+postId) == null) { - el.insertAdjacentHTML("beforeend", ` -
- ${tr('your_comment')}: -
- - -
- `) - - repSubmit.onclick = () => { - text = document.querySelector("#uRepostMsgInput_"+postId).value; - type = "wall"; - - let xhr = new XMLHttpRequest() - xhr.open("POST", "/wall"+postId+"/repost?hash="+encodeURIComponent(hash), true); - xhr.setRequestHeader('Content-type', 'application/x-www-form-urlencoded'); - xhr.onload = (function() { - if(xhr.responseText.indexOf("wall_owner") === -1) { - el.innerHTML = "can't repost" - } else { - let jsonR = JSON.parse(xhr.responseText); - location.href = "/wall" + jsonR.wall_owner - } - }); - - xhr.send('text='+encodeURI(text) + '&type='+type); - } - } else { - document.getElementById("post"+postId+"_actions").innerHTML = "" - } -} - -if(document.querySelector("#_noteDelete") != null) { - document.querySelector("#_noteDelete").addEventListener("click", (e) => { - let link = e.currentTarget.href - let hash = document.querySelector("meta[name=csrf]").getAttribute("value") - let id = e.currentTarget.dataset.id - - let xhr = new XMLHttpRequest() - xhr.open("POST", link) - xhr.setRequestHeader('Content-type', 'application/x-www-form-urlencoded'); - - xhr.onload = () => { - location.href = "/notes"+id - } - - xhr.send('hash='+encodeURIComponent(hash)); - - e.preventDefault() - }) -} \ No newline at end of file diff --git a/stylesheet.css b/stylesheet.css index cf7a22a..fe97ca8 100755 --- a/stylesheet.css +++ b/stylesheet.css @@ -1,9 +1,5 @@ input[type=checkbox], input[type=radio] { - background-color: transparent; - -webkit-appearance: none; - -moz-appearance: none; - -ms-appearance: none; height: 14px; width: 14px; outline: none; @@ -15,10 +11,10 @@ input[type=radio] { input[type=checkbox] { background-image: url("data:image/gif;base64,R0lGODlhDwA4ALMAAP//////AP8A//8AAAD//wD/AAAA/wAAADtZd8XKzuHh4crKysHBwba2tv///wAAACH5BAEAAA4ALAAAAAAPADgAAASzcMlJqVsg653X5SDgYeE2luaHdup6rmKLvq5c0rMdjlUvXb6eDoRAkFBF4yqZOBKLi2aJSUNomE1VEoCNkRLJYiLB+oLF5LJmjBinnOO0BncDBi2NvH6/dzQUgIGCgA1+g4cKhX+IgoqMjYaPhJGSjpKJlI+WlZmMm5qdiIp8pHl+paShh0WLj0mtiEywg0kMCbOBTAyUCLlolkkKWJiLZ8PEgGxogZtsY5CwcYOfnqeofREAOw=="); width: 15px; -} - -input[type=radio] { - background-image: url("../img/radio.png"); + background-color: transparent; + -webkit-appearance: none; + -moz-appearance: none; + -ms-appearance: none; } input[type=checkbox]:hover, @@ -41,6 +37,16 @@ input[type=radio]:checked:hover { -webkit-appearance: none; } +.noOverflow { + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + +iframe { + width: 100%; +} + a, a:active, a:visited { color: #3b3b3b; text-decoration: none; @@ -494,7 +500,7 @@ input, button { -webkit-appearance: button;} .tabs { margin-top: 11px; padding-bottom: 11px; - overflow-x: scroll; + overflow-x: auto; white-space: nowrap; } @@ -548,7 +554,7 @@ input, button { -webkit-appearance: button;} .picCarousel { padding: 8px 0; width: 100%; - overflow-x: scroll; + overflow-x: auto; white-space: nowrap; } @@ -964,7 +970,7 @@ img.rounded, .post > .author > .ava { background: #efefef; } /*OK*/ -.splist:active { +.splist:active, .video-list-view:active table, .container_gray a:active table { background: #e6e6e6; } .splistava { @@ -1003,18 +1009,25 @@ img.rounded, .post > .author > .ava { .photolist { padding: 10px; } + .phlistlink { padding-top: 10px; } + +.phlistlink a { + display: block; + width: 96%; +} + +.phlistlink a:focus { + background: #e7e7ed; +} + .searchinput { padding: 10px; padding-top: 1px; } - - - - .menuovk { background: #fff; width: 100%; @@ -1068,6 +1081,8 @@ img.rounded, .post > .author > .ava { width: 100%; text-align: center; margin-top: 3px; + cursor: pointer; + user-select: none; } .podrobnee:hover { background: #e4eaef; @@ -1140,6 +1155,7 @@ img.rounded, .post > .author > .ava { .listView_img { + width: 55px; max-width: 55px; max-height: 55px; border-radius: 2px; @@ -1238,7 +1254,6 @@ h4 { border-radius: 2px; outline-color: #5d80a6; -webkit-appearance: button; - margin-top: 8px; width: 100%; } .button.cfa.sr { @@ -1555,7 +1570,7 @@ h4 { } #notfg{ - background-position: 0px -392px; + background-position: 0px -393px; } .element.prmenu.gray a { @@ -1861,6 +1876,7 @@ input[type~="search"]{ } .container_gray .content { + display: block; background: #fff; padding: 4px; border: #DEDEDE solid 1px; @@ -1871,7 +1887,7 @@ input[type~="search"]{ } .ovk-video>.preview, .video-preview { - width: 126px; + width: 170px; height: 127px; align-content: center; display: flex; @@ -1880,6 +1896,12 @@ input[type~="search"]{ background-color: #000; } +.ovk-video>.preview img , .video-preview img { + width: 100%; + max-height: 127px; + margin: auto; +} + .gift_grid { width: 100%; padding: 5px; @@ -2043,6 +2065,11 @@ label, .poll > input[type=checkbox]{ cursor: pointer; vertical-align: middle; margin-top: 0%; + font-size: 17px; +} + +label { + color: black; } .poll-option{ @@ -2221,6 +2248,11 @@ select { height: 47px; } +.litePlayer.withdrawn, .litePlayer.processing { + opacity: 0.2; + pointer-events: none; +} + .audioEntry { clear: both; display: table; @@ -2231,8 +2263,40 @@ select { gap: 18px 0px; } -.litePlayer .playButton { +.audioEntry .audioButtons, .audioEntry:active .length, .audioEntry:hover .length { + display: none; +} + +.audioEntry:active .audioButtons, .audioEntry:hover .audioButtons { + display: flex; +} + +.audioEntry .audioButtons { + justify-content: flex-end; + align-items: center; +} + +.audioEntry .audioButtons > div { + cursor: pointer; +} + +.audioEntry .audioButtons .del-icon { + width: 15px; + height: 15px; + background-position: -52px -5px; +} + +.audioEntry .audioButtons .add-icon { + width: 15px; + height: 15px; + background-position: -77px -5px; +} + +.litePlayer .mobileAudiosSpritesheet, .litePlayer .playButton { background-image: url("/themepack/mobile_ovk/0.0.1.0/resource/mobile_audios.png"); +} + +.litePlayer .playButton { width: 28px; height: 31px; background-size: 236px; @@ -2350,11 +2414,120 @@ select { padding: 14px; } -.playlistInfo { +.playlistBlock .playlistInfo { margin-top: -9px; } +.playlistBlock .playlistCover img { + width: 146px; + height: 146px; +} + .lagged *, .lagged { pointer-events: none; opacity: 50%; -} \ No newline at end of file +} + +.feedTransition { + background: #ffffff; + padding: 9px 8px; + border-bottom: 1px solid #dee5eb; + cursor: pointer; + display: block; +} + +.feedTransition:active { + background: #f3f3f3; +} + +.search_options_wrapper { + margin-top: 25px; +} + +#search_options_toggler { + user-select: none; +} + +#search_options_toggler #search_options_toggler_arrow { + display: inline-block; + width: 21px; + height: 11px; + margin: 0px 0px -2px -3px; +} + +#search_options_toggler #search_options_toggler_arrow.shown { + background-position: 0px -11px; +} + +.search_options { + border-top: 1px solid #dee5eb; + margin-top: 3px; + padding: 3px 0px 3px 0px; + display: flex; + flex-direction: column; + gap: 10px; +} + +.search_options.hidden { + display: none; +} + +.search_options .search_option { + display: flex; + flex-direction: column; + gap: 4px; +} + +.search_options .search_option b { + display: block; +} + +.search_options .search_option label { + width: 100%; +} + +.search_options .search_option label.wheight { + height: 46px; +} + +.playlistListView { + display: flex; + flex-direction: row; + gap: 9px; + margin-bottom: 20px; +} + +.playlistListView:active, .playlistListView .playlistCover { + background: #ebebeb; +} + +.playlistListView .playlistInfo, .playlistListView .playlistInfo .playlistInfoTopPart { + display: flex; + flex-direction: column; +} + +.playlistListView .playlistInfo { + gap: 2px; + overflow: hidden; +} + +.playlistListView .playlistCover img { + width: 122px; + height: 122px; + object-fit: contain; +} + +.playlistListView .playlistInfo .playlistInfoTopPart span { + font-weight: 600; +} + +.arrows_spritesheet { + background: url('/themepack/mobile_ovk/0.0.1.0/resource/arrows.png'); +} + +.highlight { + background: #ffea6d; + border-bottom: 1px solid #c7c727; + font-weight: bolder; + padding: 0px 1px; +} diff --git a/tpl/@layout.xml b/tpl/@layout.xml index a6d09e9..aadb77f 100755 --- a/tpl/@layout.xml +++ b/tpl/@layout.xml @@ -22,7 +22,7 @@ {ifset headIncludes}{include headIncludes}{/ifset} - + @@ -34,15 +34,15 @@
{include title}
{ifset $thisUser} - - {if $thisUser->getUnreadMessagesCount() > 0}{$thisUser->getUnreadMessagesCount()}{/if} -
- -
- - - {else} -
+ {if $thisUser->getUnreadMessagesCount() > 0}{$thisUser->getUnreadMessagesCount()}{/if} + +
+
+ +
+
+ {else} +
{/ifset} diff --git a/tpl/Audio/List.xml b/tpl/Audio/List.xml index 82e26a4..d8a31ab 100644 --- a/tpl/Audio/List.xml +++ b/tpl/Audio/List.xml @@ -49,17 +49,17 @@
- + {_audio_new}
- + {_audio_popular}
- + {_playlists}
@@ -70,8 +70,8 @@
- - + +
@@ -106,26 +106,9 @@ {if $playlistsCount > 0} - + {foreach $playlists as $playlist} + {include "../Audio/playlistListView.xml", playlist => $playlist} + {/foreach}
{include "../components/paginator.xml", conf => (object) [ diff --git a/tpl/Audio/Playlist.xml b/tpl/Audio/Playlist.xml index 05d6dcf..3538197 100644 --- a/tpl/Audio/Playlist.xml +++ b/tpl/Audio/Playlist.xml @@ -3,38 +3,45 @@ {block title}{_playlist}{/block} {block body} - {php $count = $playlist->size()} -
-
-
- {_playlist_cover} -
- -
+
+ {if $cover} + + {_playlist_cover} + + {else} + + {_playlist_cover} + + {/if} +

{$playlist->getName()}

- {$playlist->getOwner()->getCanonicalName()} + {$playlist->getOwner()->getCanonicalName()}
{$playlist->getMetaDescription()|noescape}
{nl2br($playlist->getDescriptionHTML())|noescape}
- - - - - - - - - -
+
+ + + + + + + + + + + + +
{if $count < 1} {_empty_playlist} diff --git a/tpl/Audio/Upload.xml b/tpl/Audio/Upload.xml index cf07187..d290092 100644 --- a/tpl/Audio/Upload.xml +++ b/tpl/Audio/Upload.xml @@ -49,6 +49,7 @@ + @@ -60,14 +61,14 @@