This commit is contained in:
Juribiyan 2018-08-24 18:39:58 +05:00
parent 51d90b0d5a
commit 2ecc377439
14 changed files with 183 additions and 6 deletions

View File

@ -315,6 +315,7 @@ CREATE TABLE `PREFIX_files` (
`image_h` smallint(5) NOT NULL DEFAULT '0',
`thumb_w` smallint(5) UNSIGNED NOT NULL DEFAULT '0',
`thumb_h` smallint(5) UNSIGNED NOT NULL DEFAULT '0',
`spoiler` smallint(5) UNSIGNED NOT NULL DEFAULT '0'
PRIMARY KEY (`file_id`),
INDEX `file_md5` (`file_md5`),
INDEX `file_id` (`file_id`),
@ -361,7 +362,8 @@ AS SELECT
`files`.`image_w` AS `image_w`,
`files`.`image_h` AS `image_h`,
`files`.`thumb_w` AS `thumb_w`,
`files`.`thumb_h` AS `thumb_h`
`files`.`thumb_h` AS `thumb_h`,
`files`.`spoiler` AS `spoiler`
FROM (
`posts` LEFT JOIN `files` ON (
(

View File

@ -0,0 +1,49 @@
ALTER TABLE `files` ADD `spoiler` BOOLEAN NULL DEFAULT FALSE;
ALTER VIEW `postembeds` AS
select
`posts`.`id` AS `id`,
`posts`.`boardid` AS `boardid`,
`posts`.`parentid` AS `parentid`,
`posts`.`name` AS `name`,
`posts`.`tripcode` AS `tripcode`,
`posts`.`email` AS `email`,
`posts`.`subject` AS `subject`,
`posts`.`message` AS `message`,
`posts`.`password` AS `password`,
`posts`.`ip` AS `ip`,
`posts`.`ipmd5` AS `ipmd5`,
`posts`.`tag` AS `tag`,
`posts`.`timestamp` AS `timestamp`,
`posts`.`stickied` AS `stickied`,
`posts`.`locked` AS `locked`,
`posts`.`posterauthority` AS `posterauthority`,
`posts`.`reviewed` AS `reviewed`,
`posts`.`deleted_timestamp` AS `deleted_timestamp`,
`posts`.`IS_DELETED` AS `IS_DELETED`,
`posts`.`bumped` AS `bumped`,
`posts`.`country` AS `country`,
`files`.`file` AS `file`,
`files`.`file_id` AS `file_id`,
`files`.`file_md5` AS `file_md5`,
`files`.`file_type` AS `file_type`,
`files`.`file_original` AS `file_original`,
`files`.`file_size` AS `file_size`,
`files`.`file_size_formatted` AS `file_size_formatted`,
`files`.`image_w` AS `image_w`,
`files`.`image_h` AS `image_h`,
`files`.`thumb_w` AS `thumb_w`,
`files`.`thumb_h` AS `thumb_h`,
`files`.`spoiler` AS `spoiler`
from (
`posts`
left join
`files`
on (
(
(`files`.`post_id` = `posts`.`id`)
and
(`files`.`boardid` = `posts`.`boardid`)
)
)
)

View File

@ -524,4 +524,9 @@ color: rgb(36, 218, 226);
background: #29cbd2;
color: black!important;
text-shadow: none;
}
.spoiler-cover {
background: rgba(42, 42, 42, 0.6);
color: rgba(255, 255, 255, 0.6);
}

View File

@ -109,7 +109,7 @@
<path d="M16.005 28.993c1.658 0 3-1.342 3-3h-5.999c0 1.658 1.342 3 3 3zM16.005 23.993h-9.998v-1.998c1.998-1.001 3.189-3.758 3.335-4.948l0.638-7.296c0.34-2.808 1.67-3.489 4.025-3.756 0.059-0.95 1.061-1.998 2.001-1.998s1.942 1.049 2.001 1.998c2.353 0.267 3.685 0.95 4.025 3.756l0.638 7.296c0.146 1.188 1.337 3.947 3.335 4.948v1.998h-9.998z"></path>
</symbol>
<symbol id="i-link" viewBox="0 0 43800 43800">
<path class="fil1" d="M6500 26000l5200 -9700c1100,-1900 2900,-3300 4900,-3900l0 0c700,-200 1400,-300 2100,-300l-1600 3000c-1200,500 -2300,1300 -2900,2500l-5300 9700c-700,1300 -800,2800 -400,4200 400,1300 1300,2500 2600,3200 1400,700 2900,800 4200,400 1300,-400 2500,-1300 3300,-2600l5200 -9600c600,-1200 800,-2600 500,-3900l1700 -3000c300,600 600,1200 800,1900 600,2000 500,4300 -600,6300l-5200 9600c-1100,2000 -2900,3400 -4900,4000l0 0c-2000,600 -4300,400 -6300,-700 -2000,-1100 -3300,-2800 -3900,-4900 -600,-2000 -500,-4200 600,-6200zm11300 -6400l5200 -9600c1100,-2000 2900,-3400 4900,-4000l0 0c2000,-600 4200,-400 6200,700 2000,1000 3400,2800 4000,4900 600,2000 400,4200 -700,6200l-5200 9600c-1100,2000 -2900,3400 -4900,4000l0 0c-700,200 -1400,300 -2100,300l1700 -3000c1200,-500 2200,-1300 2900,-2600l5200 -9600c700,-1300 900,-2800 500,-4200 -400,-1300 -1400,-2500 -2700,-3200 -1300,-700 -2800,-900 -4100,-500l-100 0c-1300,400 -2500,1400 -3200,2700l-5200 9600c-700,1200 -800,2600 -500,3800l-1700 3100c-400,-600 -700,-1300 -900,-1900 -600,-2100 -400,-4300 700,-6300z"/>
<path d="M6500 26000l5200 -9700c1100,-1900 2900,-3300 4900,-3900l0 0c700,-200 1400,-300 2100,-300l-1600 3000c-1200,500 -2300,1300 -2900,2500l-5300 9700c-700,1300 -800,2800 -400,4200 400,1300 1300,2500 2600,3200 1400,700 2900,800 4200,400 1300,-400 2500,-1300 3300,-2600l5200 -9600c600,-1200 800,-2600 500,-3900l1700 -3000c300,600 600,1200 800,1900 600,2000 500,4300 -600,6300l-5200 9600c-1100,2000 -2900,3400 -4900,4000l0 0c-2000,600 -4300,400 -6300,-700 -2000,-1100 -3300,-2800 -3900,-4900 -600,-2000 -500,-4200 600,-6200zm11300 -6400l5200 -9600c1100,-2000 2900,-3400 4900,-4000l0 0c2000,-600 4200,-400 6200,700 2000,1000 3400,2800 4000,4900 600,2000 400,4200 -700,6200l-5200 9600c-1100,2000 -2900,3400 -4900,4000l0 0c-700,200 -1400,300 -2100,300l1700 -3000c1200,-500 2200,-1300 2900,-2600l5200 -9600c700,-1300 900,-2800 500,-4200 -400,-1300 -1400,-2500 -2700,-3200 -1300,-700 -2800,-900 -4100,-500l-100 0c-1300,400 -2500,1400 -3200,2700l-5200 9600c-700,1200 -800,2600 -500,3800l-1700 3100c-400,-600 -700,-1300 -900,-1900 -600,-2100 -400,-4300 700,-6300z"/>
</symbol>
<symbol id="i-select-multiple" viewBox="0 0 32 32">
<path d="M11.966 3.966v2.017h14.050v13.983h1.95v-16h-16zM3.966 11.966v16h16v-16h-16zM5.983 13.983h12.034v12.034h-12.034v-12.034zM7.462 20.773c-0.269-0.269-0.269-0.739 0-1.076 0.269-0.269 0.807-0.269 1.076 0l2.353 2.353 4.504-6.252c0.202-0.336 0.672-0.403 1.008-0.202 0.336 0.269 0.471 0.74 0.202 1.076l-4.975 6.992c0 0-0.067 0.067-0.067 0.134-0.336 0.269-0.807 0.269-1.076 0l-3.025-3.025zM8 8h16v16h-2.017v-13.983h-13.983v-2.017z"></path>
@ -118,5 +118,11 @@
<path d="M32756 36979l-10482 -15276 -257 76 0 20983 10739 -5783zm-18962 10211l0 -37993 8223 0 16838 24498 12692 -6834 0 -17664 8223 0 0 13236 8701 -4687 1644 3055 -65024 35015 -1644 -3055 10346 -5571z"/>
<path fill-opacity="0.4" d="M59770 64367l-8223 0 -17805 -25949 6101 -3286 11446 16653 257 -78 0 -22875 8223 -4428 0 39964zm-37754 -19636l0 19636 -8223 0 0 -15208 8223 -4428z"/>
</symbol>
<symbol id="i-spoiler" viewBox="0 0 60377 60377">
<path d="M30191 26418c331,0 657,21 978,63l4048 -4169c-1579,-398 -3269,-613 -5027,-613 -4564,0 -8659,1449 -11585,3791 -2751,2201 -4454,5201 -4454,8475l-5661 0c0,-5062 2523,-9613 6599,-12875 3901,-3122 9243,-5052 15101,-5052 3362,0 6555,636 9402,1769l6081 -6263 2698 2623 -5247 5404 -4058 4179 -4182 4306 -10460 10774 -1 0 -9718 10009 -2697 -2624 10732 -11053c-61,-389 -94,-790 -94,-1197 0,-4167 3377,-7546 7545,-7546zm7315 5691c150,593 230,1215 230,1856 0,4167 -3377,7546 -7545,7546 -563,0 -1112,-63 -1640,-180l8955 -9222zm9349 -9629c3148,3111 5033,7106 5033,11484l-5661 0c0,-2787 -1234,-5375 -3297,-7442l3925 -4042z"/>
</symbol>
<symbol id="i-nospoiler" viewBox="0 0 55652 55652">
<path d="M27828 24349c3841,0 6954,3114 6954,6956 0,3841 -3113,6956 -6954,6956 -3841,0 -6954,-3114 -6954,-6956 0,-3841 3113,-6956 6954,-6956zm-20003 6956c0,-4666 2326,-8861 6083,-11867 3595,-2878 8520,-4656 13919,-4656 5398,0 10322,1779 13918,4656 3758,3007 6083,7201 6083,11867l-5218 0c0,-3017 -1570,-5783 -4106,-7811 -2698,-2159 -6471,-3494 -10677,-3494 -4207,0 -7981,1336 -10679,3494 -2536,2028 -4106,4794 -4106,7811l-5218 0z"/>
</symbol>
</defs>
</svg>

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 22 KiB

View File

@ -2744,6 +2744,8 @@ figure .post-menu {
padding: 0 6px 0 3px;
padding-right: 6px;
cursor: pointer;
-webkit-transition: background-color .2s, color .2s;
-o-transition: background-color .2s, color .2s;
transition: background-color .2s, color .2s;
line-height: 24px;
white-space: nowrap;
@ -2821,4 +2823,73 @@ figure .post-menu {
.fresh-replies {
margin-top: 4px;
display: inline-block;
}
.f-spoiler {
position: relative;
overflow: hidden;
}
.f-spoiler figcaption,
.f-spoiler a img.thumb {
-webkit-transition: -webkit-filter .3s;
transition: -webkit-filter .3s;
-o-transition: filter .3s;
transition: filter .3s;
transition: filter .3s, -webkit-filter .3s;
}
.spoiler-cover {
position: absolute;
width: 100%;
height: 100%;
z-index: 1;
line-height: 100%;
text-align: center;
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
border: 1px dashed currentColor;
box-sizing: border-box;
}
.spoiler-cover .icon {
width: 32px;
height: 32px;
}
.spoiler-checkbox {
display: none;
}
.spoiler-checkbox:checked + label .spoiler-cover {
display: none;
}
.spoiler-checkbox:not(:checked) + label + figcaption,
.spoiler-checkbox:not(:checked) + label + figcaption + a img.thumb {
opacity: 0;
}
@supports ((-webkit-filter: blur(15px)) or (filter: blur(15px))) {
.spoiler-checkbox:not(:checked) + label + figcaption,
.spoiler-checkbox:not(:checked) + label + figcaption + a img.thumb {
-webkit-filter: blur(15px);
filter: blur(15px);
opacity: 1;
}
.spoiler-cover {
border: none;
}
}
.spoiler-cover div {
vertical-align: middle;
display: inline-block;
-webkit-align-self: center;
-ms-flex-item-align: center;
-ms-grid-row-align: center;
align-self: center;
opacity: .7;
-webkit-transition: opacity .2s;
-o-transition: opacity .2s;
transition: opacity .2s;
margin: 0px auto;
}
.spoiler-cover:hover div {
opacity: 1;
}

View File

@ -407,4 +407,9 @@ figure {
.salient {
background: #6188b6;
color: white!important;
}
.spoiler-cover {
background: rgba(199, 225, 255, 0.53);
color: rgba(0, 0, 0, 0.5);
}

View File

@ -495,4 +495,9 @@ figure:hover {
.salient {
background: #37c999;
color: black!important;
}
.spoiler-cover {
background: rgba(44, 51, 61, 0.6);
color: rgba(255, 255, 255, 0.75);
}

View File

@ -376,4 +376,9 @@ figure .post-menu {
.salient {
background: #ff6500;
color: white!important;
}
.spoiler-cover {
background: rgba(206, 206, 206, 0.7);
color: rgb(249, 101, 0);
}

View File

@ -485,4 +485,9 @@ figure:hover {
.salient {
background: #8749a5;
color: rgba(255, 255, 255, 0.7)!important;
}
.spoiler-cover {
background: rgba(42, 42, 42, 0.6);
color: rgba(255, 255, 255, 0.6);
}

View File

@ -147,7 +147,16 @@
{t}File<br />Removed{/t}
</div>
{else}
<figure class="multiembed{if $embed.is_embed} video-embed{/if}" data-fileid="{$embed.file_id}">
<figure class="multiembed{if $embed.is_embed} video-embed{/if}{if $embed.spoiler} f-spoiler{/if}" data-fileid="{$embed.file_id}">
{if $embed.spoiler}
<input type="checkbox" class="spoiler-checkbox" id="emb-{$embed.file_id}-spoiler">
<label for="emb-{$embed.file_id}-spoiler" title="{t}Spoiler{/t}"><div class="spoiler-cover"><div>
<svg class="icon yesscript">
<use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#i-spoiler"></use>
</svg><br class="yesscript">
<noscript>{t}Spoiler{/t}</noscript>
</div></div></label>
{/if}
{if !$embed.is_embed}
{assign var="filename" value=get_embed_filename($embed)}
<figcaption class="filesize">

View File

@ -105,6 +105,15 @@
</svg>
</span>
</label>
<label class="icon-checkbox-wrap" title="{t}Spoiler{/t}" for="spoiler-{$embcnt-1}">
<input type="checkbox" name="spoiler-{$embcnt-1}" id="spoiler-{$embcnt-1}" value="1">
<span class="icon-with-fallback">
<noscript class="b-icon">S</noscript>
<svg class="icon b-icon yesscript">
<use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#i-spoiler"></use>
</svg>
</span>
</label>
</div>
{if $embcnt < $board.maxfiles}
<input type="checkbox" name="addfile-{$embcnt}" id="addfile-{$embcnt}" class="add-embed">

View File

@ -1144,7 +1144,9 @@ class Post extends Board {
//thumb_w
intval($attachment['imgWidth_thumb']),
//thumb_h
intval($attachment['imgHeight_thumb'])
intval($attachment['imgHeight_thumb']),
//spoiler
$attachment['spoiler']
);
foreach($fields as &$field) {
$field = $tc_db->qstr($field);
@ -1152,7 +1154,7 @@ class Post extends Board {
$row_inserts []= '('. implode(', ', $fields) . ')';
}
$fquery = "INSERT INTO `".KU_DBPREFIX."files`
(`post_id`, `boardid`, `file` , `file_original`, `file_type` , `file_md5` , `image_w` , `image_h` , `file_size` , `file_size_formatted` , `thumb_w` , `thumb_h`)
(`post_id`, `boardid`, `file` , `file_original`, `file_type` , `file_md5` , `image_w` , `image_h` , `file_size` , `file_size_formatted` , `thumb_w` , `thumb_h`, `spoiler`)
VALUES " . implode(',', $row_inserts);
$tc_db->Execute($fquery);
$sqlerr = $tc_db->ErrorNo();

View File

@ -94,6 +94,7 @@ class Upload {
}
$file_entry = array(
'attachmenttype' => 'file',
'spoiler' => $_POST['spoiler-'.$i] || '0',
'file_original' => $_POST['hidename-'.$i]==1 ? '/hidden' : preg_replace('/(.*)\..+/','\1', $filename),
'tmp_name' => $_FILES['imagefile']['tmp_name'][$i],
'type' => $_FILES['imagefile']['type'][$i],
@ -129,6 +130,7 @@ class Upload {
}
$attachments []= array(
'attachmenttype' => 'embed',
'spoiler' => $_POST['spoiler-'.$i] || '0',
'embedtype' => $embed_filetype,
'embed' => $code,
'filetype_withoutdot' => $embed_filetype,

View File

@ -135,6 +135,7 @@ function group_embeds($r, $group_deleted_files = false) {
unset($rg[$i]['image_h']);
unset($rg[$i]['thumb_w']);
unset($rg[$i]['thumb_h']);
unset($rg[$i]['spoiler']);
$current_id = $id;
}
if ($pe['file']) {
@ -159,7 +160,8 @@ function group_embeds($r, $group_deleted_files = false) {
'image_w' => $pe['image_w'],
'image_h' => $pe['image_h'],
'thumb_w' => $pe['thumb_w'],
'thumb_h' => $pe['thumb_h']
'thumb_h' => $pe['thumb_h'],
'spoiler' => $pe['spoiler']
);
}
}