File size: 10,414 Bytes
a47e1ac |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 |
"use strict";
var { registerBlockType } = wp.blocks;
var gcel = wp.element.createElement;
registerBlockType( 'ultimate-manga-scraper/ums-list', {
title: 'Ultimate Mange Scraper List Posts',
icon: 'smartphone',
category: 'embed',
attributes: {
ruletype : {
default: '',
type: 'string',
},
ruleid : {
default: '',
type: 'string',
},
category : {
default: '',
type: 'string',
},
posts : {
default: '50',
type: 'string',
},
orderby : {
default: 'title',
type: 'string',
},
order : {
default: 'ASC',
type: 'string',
},
type : {
default: 'any',
type: 'string',
}
},
keywords: ['list', 'posts', 'ums'],
edit: (function( props ) {
var ruletype = props.attributes.ruletype;
var ruleid = props.attributes.ruleid;
var category = props.attributes.category;
var posts = props.attributes.posts;
var orderby = props.attributes.orderby;
var order = props.attributes.order;
var type = props.attributes.type;
function updateMessage( event ) {
props.setAttributes( { ruletype: event.target.value} );
}
function updateMessage2( event ) {
props.setAttributes( { ruleid: event.target.value} );
}
function updateMessage3( event ) {
props.setAttributes( { category: event.target.value} );
}
function updateMessage4( event ) {
props.setAttributes( { posts: event.target.value} );
}
function updateMessage5( event ) {
props.setAttributes( { orderby: event.target.value} );
}
function updateMessage6( event ) {
props.setAttributes( { order: event.target.value} );
}
function updateMessage7( event ) {
props.setAttributes( { type: event.target.value} );
}
return gcel(
'div',
{ className: 'coderevolution_gutenberg_div' },
gcel(
'h4',
{ className: 'coderevolution_gutenberg_title' },
'Ultimate Mange Scraper List Posts ',
gcel(
'div',
{className:'bws_help_box bws_help_box_right dashicons dashicons-editor-help'}
,
gcel(
'div',
{className:'bws_hidden_help_text'},
'This block is used to list posts generated by this plugin. It is a simple way to list posts.'
)
)
),
gcel(
'label',
{ className: 'coderevolution_gutenberg_label' },
'Rule Type: '
),
gcel(
'div',
{className:'bws_help_box bws_help_box_right dashicons dashicons-editor-help'}
,
gcel(
'div',
{className:'bws_hidden_help_text'},
'Select the source of the posts that will be listed.'
)
),
gcel(
'select',
{ value: ruletype, onChange: updateMessage, className: 'coderevolution_gutenberg_select' },
gcel(
'option',
{ value: 0},
'APKs to Posts'
),
gcel(
'option',
{ value: 0},
'Custom Page Import'
),
gcel(
'option',
{ value: ''},
'Any'
)
),
gcel(
'br'
),
gcel(
'label',
{ className: 'coderevolution_gutenberg_label' },
'Rule ID: '
),
gcel(
'div',
{className:'bws_help_box bws_help_box_right dashicons dashicons-editor-help'}
,
gcel(
'div',
{className:'bws_hidden_help_text'},
'Select the ID of the rule you wish to list posts from. To list all posts from a specific rule, leave this field blank.'
)
),
gcel(
'input',
{ type:'number',min:0,placeholder:'Rule id to list', value: ruleid, onChange: updateMessage2, className: 'coderevolution_gutenberg_input' }
),
gcel(
'br'
),
gcel(
'label',
{ className: 'coderevolution_gutenberg_label' },
'Category Slug: '
),
gcel(
'div',
{className:'bws_help_box bws_help_box_right dashicons dashicons-editor-help'}
,
gcel(
'div',
{className:'bws_hidden_help_text'},
'Select the post category slug from where you wish to list posts.'
)
),
gcel(
'textarea',
{ rows:1,placeholder:'Category slug', value: category, onChange: updateMessage3, className: 'coderevolution_gutenberg_input' }
),
gcel(
'br'
),
gcel(
'label',
{ className: 'coderevolution_gutenberg_label' },
'Posts Per Page: '
),
gcel(
'div',
{className:'bws_help_box bws_help_box_right dashicons dashicons-editor-help'}
,
gcel(
'div',
{className:'bws_hidden_help_text'},
'Select the number of posts to be shown at max.'
)
),
gcel(
'input',
{ type:'number',min:1,placeholder:'10', value: posts, onChange: updateMessage4, className: 'coderevolution_gutenberg_input' }
),
gcel(
'br'
),
gcel(
'label',
{ className: 'coderevolution_gutenberg_label' },
'Order By: '
),
gcel(
'div',
{className:'bws_help_box bws_help_box_right dashicons dashicons-editor-help'}
,
gcel(
'div',
{className:'bws_hidden_help_text'},
'Select how to order results.'
)
),
gcel(
'select',
{ value: orderby, onChange: updateMessage5, className: 'coderevolution_gutenberg_select' },
gcel(
'option',
{ value: 'none'},
'none'
),
gcel(
'option',
{ value: 'date'},
'date'
),
gcel(
'option',
{ value: 'ID'},
'ID'
),
gcel(
'option',
{ value: 'author'},
'author'
),
gcel(
'option',
{ value: 'title'},
'title'
),
gcel(
'option',
{ value: 'name'},
'name'
),
gcel(
'option',
{ value: 'type'},
'type'
),
gcel(
'option',
{ value: 'modified'},
'modified'
),
gcel(
'option',
{ value: 'parent'},
'parent'
),
gcel(
'option',
{ value: 'rand'},
'rand'
),
gcel(
'option',
{ value: 'comment_count'},
'comment_count'
),
gcel(
'option',
{ value: 'relevance'},
'relevance'
),
gcel(
'option',
{ value: 'menu_order'},
'menu_order'
)
),
gcel(
'br'
),
gcel(
'label',
{ className: 'coderevolution_gutenberg_label' },
'Sort By: '
),
gcel(
'div',
{className:'bws_help_box bws_help_box_right dashicons dashicons-editor-help'}
,
gcel(
'div',
{className:'bws_hidden_help_text'},
'Select how to sort results.'
)
),
gcel(
'select',
{ value: order, onChange: updateMessage6, className: 'coderevolution_gutenberg_select' },
gcel(
'option',
{ value: 'ASC'},
'ASC'
),
gcel(
'option',
{ value: 'DESC'},
'DESC'
)
),
gcel(
'br'
),
gcel(
'label',
{ className: 'coderevolution_gutenberg_label' },
'Post Type: '
),
gcel(
'div',
{className:'bws_help_box bws_help_box_right dashicons dashicons-editor-help'}
,
gcel(
'div',
{className:'bws_hidden_help_text'},
'Select the post type to be listed. You can input a comma separated list of multiple post types (custom post types supported).'
)
),
gcel(
'textarea',
{ rows:1,placeholder:'post', value: type, onChange: updateMessage7, className: 'coderevolution_gutenberg_input' }
)
);
}),
save: (function( props ) {
return null;
}),
} ); |