@ -1,7 +1,7 @@
// ==UserScript==
// @name PNGExtraEmbed
// @namespace https://coom.tech/
// @version 0.247
// @version 0.249
// @description uhh
// @author You
// @match https://boards.4channel.org/*
@ -87,7 +87,7 @@ const _DOMParser = DOMParser;
var define_BUILD_VERSION_default ;
var init_define_BUILD_VERSION = __ esm ( {
"<define:BUILD_VERSION>" ( ) {
define_BUILD_VERSION_default = [ 0 , 247 ] ;
define_BUILD_VERSION_default = [ 0 , 249 ] ;
}
} ) ;
@ -16753,7 +16753,7 @@ const _DOMParser = DOMParser;
var has_embed2 = ( webm ) => {
const dec = new ebml . Decoder ( ) ;
const chunks = dec . decode ( webm ) ;
const embed2 = chunks . findIndex ( ( e ) => e . name == "TagName" && e . type == "8" && e . value == "DOOM" ) ;
const embed2 = chunks . findIndex ( ( e ) => e . name == "TagName" && e . type == "8" && ( e . value == "DOOM" || e . value == "VOOM" ) ) ;
const cl = chunks . find ( ( e ) => e . name == "Cluster" ) ;
if ( cl && embed2 == - 1 )
return false ;
@ -21189,65 +21189,6 @@ const _DOMParser = DOMParser;
}
} ;
}
function create_if_block_22 ( ctx ) {
let tabpanel ;
let current ;
tabpanel = new TabPanel_default ( {
props : {
$$slots : { default : [ create_default_slot_2 ] } ,
$$scope : { ctx }
}
} ) ;
return {
c ( ) {
create_component ( tabpanel . $$ . fragment ) ;
} ,
m ( target , anchor ) {
mount_component ( tabpanel , target , anchor ) ;
current = true ;
} ,
i ( local ) {
if ( current )
return ;
transition_in ( tabpanel . $$ . fragment , local ) ;
current = true ;
} ,
o ( local ) {
transition_out ( tabpanel . $$ . fragment , local ) ;
current = false ;
} ,
d ( detaching ) {
destroy_component ( tabpanel , detaching ) ;
}
} ;
}
function create_default_slot_2 ( ctx ) {
let hydrussearch ;
let current ;
hydrussearch = new HydrusSearch_default ( { } ) ;
return {
c ( ) {
create_component ( hydrussearch . $$ . fragment ) ;
} ,
m ( target , anchor ) {
mount_component ( hydrussearch , target , anchor ) ;
current = true ;
} ,
i ( local ) {
if ( current )
return ;
transition_in ( hydrussearch . $$ . fragment , local ) ;
current = true ;
} ,
o ( local ) {
transition_out ( hydrussearch . $$ . fragment , local ) ;
current = false ;
} ,
d ( detaching ) {
destroy_component ( hydrussearch , detaching ) ;
}
} ;
}
function create_else_block2 ( ctx ) {
let each_1_anchor ;
let each_value = ctx [ 3 ] ;
@ -21295,7 +21236,7 @@ const _DOMParser = DOMParser;
}
} ;
}
function create_if_block_1 2 ( ctx ) {
function create_if_block_2 2 ( ctx ) {
let p ;
return {
c ( ) {
@ -21351,13 +21292,13 @@ const _DOMParser = DOMParser;
}
} ;
}
function create_default_slot_1 ( ctx ) {
function create_default_slot_2 ( ctx ) {
let p ;
let t2 ;
let div ;
function select_block_type_1 ( ctx2 , dirty ) {
if ( ctx2 [ 3 ] . length == 0 )
return create_if_block_1 2 ;
return create_if_block_2 2 ;
return create_else_block2 ;
}
let current_block_type = select_block_type_1 ( ctx , [ - 1 , - 1 , - 1 ] ) ;
@ -21400,6 +21341,65 @@ const _DOMParser = DOMParser;
}
} ;
}
function create_if_block_12 ( ctx ) {
let tabpanel ;
let current ;
tabpanel = new TabPanel_default ( {
props : {
$$slots : { default : [ create_default_slot_1 ] } ,
$$scope : { ctx }
}
} ) ;
return {
c ( ) {
create_component ( tabpanel . $$ . fragment ) ;
} ,
m ( target , anchor ) {
mount_component ( tabpanel , target , anchor ) ;
current = true ;
} ,
i ( local ) {
if ( current )
return ;
transition_in ( tabpanel . $$ . fragment , local ) ;
current = true ;
} ,
o ( local ) {
transition_out ( tabpanel . $$ . fragment , local ) ;
current = false ;
} ,
d ( detaching ) {
destroy_component ( tabpanel , detaching ) ;
}
} ;
}
function create_default_slot_1 ( ctx ) {
let hydrussearch ;
let current ;
hydrussearch = new HydrusSearch_default ( { } ) ;
return {
c ( ) {
create_component ( hydrussearch . $$ . fragment ) ;
} ,
m ( target , anchor ) {
mount_component ( hydrussearch , target , anchor ) ;
current = true ;
} ,
i ( local ) {
if ( current )
return ;
transition_in ( hydrussearch . $$ . fragment , local ) ;
current = true ;
} ,
o ( local ) {
transition_out ( hydrussearch . $$ . fragment , local ) ;
current = false ;
} ,
d ( detaching ) {
destroy_component ( hydrussearch , detaching ) ;
}
} ;
}
function create_default_slot ( ctx ) {
let tablist ;
let t0 ;
@ -21411,8 +21411,9 @@ const _DOMParser = DOMParser;
let t3 ;
let tabpanel3 ;
let t4 ;
let t5 ;
let tabpanel4 ;
let t5 ;
let if_block_anchor ;
let current ;
tablist = new TabList_default ( {
props : {
@ -21444,13 +21445,13 @@ const _DOMParser = DOMParser;
$$scope : { ctx }
}
} ) ;
let if_block = ctx [ 8 ] . akValid && create_if_block_22 ( ctx ) ;
tabpanel4 = new TabPanel_default ( {
props : {
$$slots : { default : [ create_default_slot_1 ] } ,
$$slots : { default : [ create_default_slot_2 ] } ,
$$scope : { ctx }
}
} ) ;
let if_block = ctx [ 8 ] . akValid && create_if_block_12 ( ctx ) ;
return {
c ( ) {
create_component ( tablist . $$ . fragment ) ;
@ -21463,10 +21464,11 @@ const _DOMParser = DOMParser;
t3 = space ( ) ;
create_component ( tabpanel3 . $$ . fragment ) ;
t4 = space ( ) ;
create_component ( tabpanel4 . $$ . fragment ) ;
t5 = space ( ) ;
if ( if_block )
if_block . c ( ) ;
t5 = space ( ) ;
create_component ( tabpanel4 . $$ . fragment ) ;
if_block_anchor = empty ( ) ;
} ,
m ( target , anchor ) {
mount_component ( tablist , target , anchor ) ;
@ -21479,10 +21481,11 @@ const _DOMParser = DOMParser;
insert ( target , t3 , anchor ) ;
mount_component ( tabpanel3 , target , anchor ) ;
insert ( target , t4 , anchor ) ;
mount_component ( tabpanel4 , target , anchor ) ;
insert ( target , t5 , anchor ) ;
if ( if_block )
if_block . m ( target , anchor ) ;
insert ( target , t5 , anchor ) ;
mount_component ( tabpanel4 , target , anchor ) ;
insert ( target , if_block_anchor , anchor ) ;
current = true ;
} ,
p ( ctx2 , dirty ) {
@ -21511,16 +21514,21 @@ const _DOMParser = DOMParser;
tabpanel3_changes . $$scope = { dirty , ctx : ctx2 } ;
}
tabpanel3 . $set ( tabpanel3_changes ) ;
const tabpanel4_changes = { } ;
if ( dirty [ 0 ] & 8 | dirty [ 2 ] & 256 ) {
tabpanel4_changes . $$scope = { dirty , ctx : ctx2 } ;
}
tabpanel4 . $set ( tabpanel4_changes ) ;
if ( ctx2 [ 8 ] . akValid ) {
if ( if_block ) {
if ( dirty [ 0 ] & 256 ) {
transition_in ( if_block , 1 ) ;
}
} else {
if_block = create_if_block_2 2 ( ctx2 ) ;
if_block = create_if_block_1 2 ( ctx2 ) ;
if_block . c ( ) ;
transition_in ( if_block , 1 ) ;
if_block . m ( t5 . parentNode , t5 ) ;
if_block . m ( if_block_anchor . parentNode , if_block_anchor ) ;
}
} else if ( if_block ) {
group_outros ( ) ;
@ -21529,11 +21537,6 @@ const _DOMParser = DOMParser;
} ) ;
check_outros ( ) ;
}
const tabpanel4_changes = { } ;
if ( dirty [ 0 ] & 8 | dirty [ 2 ] & 256 ) {
tabpanel4_changes . $$scope = { dirty , ctx : ctx2 } ;
}
tabpanel4 . $set ( tabpanel4_changes ) ;
} ,
i ( local ) {
if ( current )
@ -21543,8 +21546,8 @@ const _DOMParser = DOMParser;
transition_in ( tabpanel1 . $$ . fragment , local ) ;
transition_in ( tabpanel2 . $$ . fragment , local ) ;
transition_in ( tabpanel3 . $$ . fragment , local ) ;
transition_in ( if_block ) ;
transition_in ( tabpanel4 . $$ . fragment , local ) ;
transition_in ( if_block ) ;
current = true ;
} ,
o ( local ) {
@ -21553,8 +21556,8 @@ const _DOMParser = DOMParser;
transition_out ( tabpanel1 . $$ . fragment , local ) ;
transition_out ( tabpanel2 . $$ . fragment , local ) ;
transition_out ( tabpanel3 . $$ . fragment , local ) ;
transition_out ( if_block ) ;
transition_out ( tabpanel4 . $$ . fragment , local ) ;
transition_out ( if_block ) ;
current = false ;
} ,
d ( detaching ) {
@ -21573,11 +21576,13 @@ const _DOMParser = DOMParser;
destroy_component ( tabpanel3 , detaching ) ;
if ( detaching )
detach ( t4 ) ;
destroy_component ( tabpanel4 , detaching ) ;
if ( detaching )
detach ( t5 ) ;
if ( if_block )
if_block . d ( detaching ) ;
if ( detaching )
detach ( t5 ) ;
destroy_component ( tabpanel4 , detaching ) ;
detach ( if_block_anchor ) ;
}
} ;
}
@ -22164,7 +22169,7 @@ const _DOMParser = DOMParser;
function create_if_block8 ( ctx ) {
let a ;
let i ;
let t_value = ctx [ 1 ] . is4chanX ? "" : "\u274C" ;
let t_value = ctx [ 2 ] . is4chanX ? "" : "\u274C" ;
let t ;
let a_title_value ;
let mounted ;
@ -22183,12 +22188,12 @@ const _DOMParser = DOMParser;
append ( a , i ) ;
append ( i , t ) ;
if ( ! mounted ) {
dispose = listen ( a , "click" , ctx [ 7 ] ) ;
dispose = listen ( a , "click" , ctx [ 8 ] ) ;
mounted = true ;
}
} ,
p ( ctx2 , dirty ) {
if ( dirty & 2 && t_value !== ( t_value = ctx2 [ 1 ] . is4chanX ? "" : "\u274C" ) )
if ( dirty & 4 && t_value !== ( t_value = ctx2 [ 2 ] . is4chanX ? "" : "\u274C" ) )
set_data ( t , t_value ) ;
if ( dirty & 1 && a_title_value !== ( a_title_value = "Discard ALL " + ctx2 [ 0 ] . length + " files" ) ) {
attr ( a , "title" , a_title_value ) ;
@ -22206,15 +22211,20 @@ const _DOMParser = DOMParser;
let div1 ;
let a0 ;
let i0 ;
let t0_value = ctx [ 1 ] . is4chanX ? "" : "\u{1F9F2}" ;
let t0_value = ctx [ 2 ] . is4chanX ? "" : "\u{1F9F2}" ;
let t0 ;
let t1 ;
let div0 ;
let a1 ;
let i1 ;
let t2_value = ctx [ 1 ] . is4chanX ? "" : "\u{1F589}" ;
let t2_value = ctx [ 2 ] . is4chanX ? "" : "\u{1F589}" ;
let t2 ;
let t3 ;
let a2 ;
let i2 ;
let t4_value = ctx [ 2 ] . is4chanX ? "" : "\u{1F4CB}" ;
let t4 ;
let t5 ;
let mounted ;
let dispose ;
let if_block = ctx [ 0 ] . length && create_if_block8 ( ctx ) ;
@ -22230,6 +22240,10 @@ const _DOMParser = DOMParser;
i1 = element ( "i" ) ;
t2 = text ( t2_value ) ;
t3 = space ( ) ;
a2 = element ( "a" ) ;
i2 = element ( "i" ) ;
t4 = text ( t4_value ) ;
t5 = space ( ) ;
if ( if_block )
if_block . c ( ) ;
attr ( i0 , "class" , "fa fa-magnet svelte-bgqqj3" ) ;
@ -22238,6 +22252,9 @@ const _DOMParser = DOMParser;
attr ( i1 , "class" , "fa fa-pencil svelte-bgqqj3" ) ;
attr ( a1 , "title" , "Add a message (this uses the content of the comment text box)" ) ;
attr ( a1 , "class" , "svelte-bgqqj3" ) ;
attr ( i2 , "class" , "fa fa-clipboard svelte-bgqqj3" ) ;
attr ( a2 , "title" , "Add from clipboard (click this then CTRL+v)" ) ;
attr ( a2 , "class" , "svelte-bgqqj3" ) ;
attr ( div0 , "class" , "additionnal svelte-bgqqj3" ) ;
attr ( div1 , "class" , "root svelte-bgqqj3" ) ;
} ,
@ -22252,21 +22269,28 @@ const _DOMParser = DOMParser;
append ( a1 , i1 ) ;
append ( i1 , t2 ) ;
append ( div0 , t3 ) ;
append ( div0 , a2 ) ;
append ( a2 , i2 ) ;
append ( i2 , t4 ) ;
append ( div0 , t5 ) ;
if ( if_block )
if_block . m ( div0 , null ) ;
ctx [ 9 ] ( div0 ) ;
if ( ! mounted ) {
dispose = [
listen ( a0 , "click" , ctx [ 4 ] ) ,
listen ( a1 , "click" , ctx [ 3 ] )
listen ( a0 , "click" , ctx [ 5 ] ) ,
listen ( a1 , "click" , ctx [ 4 ] )
] ;
mounted = true ;
}
} ,
p ( ctx2 , [ dirty ] ) {
if ( dirty & 2 && t0_value !== ( t0_value = ctx2 [ 1 ] . is4chanX ? "" : "\u{1F9F2}" ) )
if ( dirty & 4 && t0_value !== ( t0_value = ctx2 [ 2 ] . is4chanX ? "" : "\u{1F9F2}" ) )
set_data ( t0 , t0_value ) ;
if ( dirty & 2 && t2_value !== ( t2_value = ctx2 [ 1 ] . is4chanX ? "" : "\u{1F589}" ) )
if ( dirty & 4 && t2_value !== ( t2_value = ctx2 [ 2 ] . is4chanX ? "" : "\u{1F589}" ) )
set_data ( t2 , t2_value ) ;
if ( dirty & 4 && t4_value !== ( t4_value = ctx2 [ 2 ] . is4chanX ? "" : "\u{1F4CB}" ) )
set_data ( t4 , t4_value ) ;
if ( ctx2 [ 0 ] . length ) {
if ( if_block ) {
if_block . p ( ctx2 , dirty ) ;
@ -22287,6 +22311,7 @@ const _DOMParser = DOMParser;
detach ( div1 ) ;
if ( if_block )
if_block . d ( ) ;
ctx [ 9 ] ( null ) ;
mounted = false ;
run_all ( dispose ) ;
}
@ -22295,11 +22320,41 @@ const _DOMParser = DOMParser;
function instance11 ( $$self , $$props , $$invalidate ) {
let $settings ;
let $appState ;
component_subscribe ( $$self , settings , ( $$value ) => $$invalidate ( 11 , $settings = $$value ) ) ;
component_subscribe ( $$self , appState , ( $$value ) => $$invalidate ( 1 , $appState = $$value ) ) ;
component_subscribe ( $$self , settings , ( $$value ) => $$invalidate ( 13 , $settings = $$value ) ) ;
component_subscribe ( $$self , appState , ( $$value ) => $$invalidate ( 2 , $appState = $$value ) ) ;
let { processors : processors2 = [ ] } = $$props ;
let { textinput } = $$props ;
let { links = [ ] } = $$props ;
let floating ;
const isParentOrSame = ( p , ofe ) => {
while ( ofe && ofe != document . body ) {
if ( p == ofe )
return true ;
ofe = ofe . parentElement ;
}
return false ;
} ;
const handleGlobalPaste = ( e ) => {
if ( ! e . clipboardData ) {
return ;
}
if ( isParentOrSame ( floating , e . target ) ) {
if ( e . clipboardData . files . length == 0 ) {
if ( e . clipboardData . types . includes ( "text/plain" ) ) {
const data = e . clipboardData . getData ( "text/plain" ) ;
addContent ( new File ( [ new Blob ( [ data ] , { type : "text/plain" } ) ] , ` message ${ links . length } .txt ` ) ) ;
}
} else {
addContent ( ... [ ... e . clipboardData . files ] ) ;
}
e . stopImmediatePropagation ( ) ;
e . stopPropagation ( ) ;
return true ;
}
} ;
onMount ( ( ) => {
document . addEventListener ( "paste" , handleGlobalPaste , true ) ;
} ) ;
const addContent = async ( ... newfiles ) => {
$$invalidate ( 0 , links = [ ... links , ... await uploadFiles ( newfiles ) ] ) ;
return embedContent ( { } ) ;
@ -22351,15 +22406,24 @@ const _DOMParser = DOMParser;
return ;
}
await addContent ( new File ( [ new Blob ( [ textinput . value ] , { type : "text/plain" } ) ] , ` message ${ links . length } .txt ` ) ) ;
$$invalidate ( 5 , textinput . value = "" , textinput ) ;
$$invalidate ( 6 , textinput . value = "" , textinput ) ;
} ;
const embedContent = async ( e ) => {
const file = original ;
if ( ! file )
let t file = original ;
if ( ! t file)
return ;
if ( links . length == 0 )
return ;
const type = file . type ;
const type = tfile . type ;
let file ;
if ( ! ( tfile instanceof File ) ) {
const et = await fileTypeFromBuffer ( await tfile . arrayBuffer ( ) ) ;
if ( ! et )
throw new Error ( "Unsupported container type" ) ;
file = new File ( [ tfile ] , ` file. ${ et . ext } ` ) ;
} else {
file = tfile ;
}
try {
const proc = processors2 . filter ( ( e2 ) => e2 . inject ) . find ( ( e2 ) => e2 . match ( file . name ) ) ;
if ( ! proc )
@ -22387,39 +22451,47 @@ const _DOMParser = DOMParser;
input . click ( ) ;
} ;
const click_handler2 = ( ) => ( $$invalidate ( 0 , links = [ ] ) , restore ( ) ) ;
function div0_binding ( $$value ) {
binding_callbacks [ $$value ? "unshift" : "push" ] ( ( ) => {
floating = $$value ;
$$invalidate ( 1 , floating ) ;
} ) ;
}
$$self . $$set = ( $$props2 ) => {
if ( "processors" in $$props2 )
$$invalidate ( 6 , processors2 = $$props2 . processors ) ;
$$invalidate ( 7 , processors2 = $$props2 . processors ) ;
if ( "textinput" in $$props2 )
$$invalidate ( 5 , textinput = $$props2 . textinput ) ;
$$invalidate ( 6 , textinput = $$props2 . textinput ) ;
if ( "links" in $$props2 )
$$invalidate ( 0 , links = $$props2 . links ) ;
} ;
return [
links ,
floating ,
$appState ,
restore ,
embedText ,
embedFile ,
textinput ,
processors2 ,
click_handler2
click_handler2 ,
div0_binding
] ;
}
var PostOptions = class extends SvelteComponent {
constructor ( options ) {
super ( ) ;
init ( this , options , instance11 , create_fragment11 , safe_not_equal , { processors : 6 , textinput : 5 , links : 0 } , add_css10 ) ;
init ( this , options , instance11 , create_fragment11 , safe_not_equal , { processors : 7 , textinput : 6 , links : 0 } , add_css10 ) ;
}
get processors ( ) {
return this . $$ . ctx [ 6 ] ;
return this . $$ . ctx [ 7 ] ;
}
set processors ( processors2 ) {
this . $$set ( { processors : processors2 } ) ;
flush ( ) ;
}
get textinput ( ) {
return this . $$ . ctx [ 5 ] ;
return this . $$ . ctx [ 6 ] ;
}
set textinput ( textinput ) {
this . $$set ( { textinput } ) ;