Changeset 2313849
- Timestamp:
- 05/28/2020 03:13:40 PM (5 years ago)
- Location:
- lorim-ipsm/trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
lorim-ipsm/trunk/dist/blocks.build.js
r2313806 r2313849 1 !function(e){function t(a){if(r[a])return r[a].exports;var i=r[a]={i:a,l:!1,exports:{}};return e[a].call(i.exports,i,i.exports,t),i.l=!0,i.exports}var r={};t.m=e,t.c=r,t.d=function(e,r,a){t.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:a})},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=2)}([function(e,t){},function(e,t){},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});r(3),r(4)},function(e,t,r){"use strict";function a(e){return function(){return(e=1e4*Math.sin(e))-Math.floor(e)}}var i=r(0),n=(r.n(i),r(1)),__=(r.n(n),wp.i18n.__),s=wp.element.createElement,o=wp.blocks.registerBlockType,u=wp.components.TextControl;o("cgb/block-lorim-ipsm",{title:__("lorim-ipsm"),icon:"text",category:"common",keywords:[__("placeholder text"),__("lorim ipsm block"),__("utility block")],attributes:{paragraphs:{type:"string",default:1,source:"html",selector:".paragraphs"},wordsPer Sentance:{type:"string",default:24,source:"html",selector:".wordsPerSentance"},sentancesPerParagraph:{type:"string",default:5,source:"html",selector:".sentancesPerParagraph"},randomSeed:{type:"string",default:627,source:"html",selector:".randomSeed"}},edit:function(e){var t=(e.attributes,e.setAttributes);return s("div",{className:e.className},s(u,{label:"How many paragraphs of lorem ipsum?",value:e.attributes.paragraphs,onChange:function(e){t({paragraphs:e})}}),s(u,{label:"Max words per sentance?",value:e.attributes.wordsPerSentance,onChange:function(e){t({wordsPerSentance:e})}}),s(u,{label:"Max sentances per paragraph?",value:e.attributes.sentancesPerParagraph,onChange:function(e){t({sentancesPerParagraph:e})}}),s(u,{label:"Seed for random ipsm generation?",value:e.attributes.randomSeed,onChange:function(e){t({randomSeed:e})}}))},save:function(e){var t=[],r=["lorem","ipsum","dolor","sit","amet","consectetur","adipiscing","elit","donec","nec","nulla","vitae","lacus","mattis","volutpat","eu","at","sapien","nunc","interdum","congue","libero","quis","laoreet","elit",",","sagittis","ut","pellentesque","lacus","erat","dictum","condimentum","pharetra","vel","malesuada","volutpat","risus","nunc","sit","amet","risus","dolor","etiam","posuere","tellus","nisl","Integer","lorem","ligula","tempor","eu","laoreet","ac","eleifend","quis","diam","proin","cursus","nibh","eu","vehicula","varius","lacus","elit",",","eleifend","elit","eget","commodo","ante","felis","at","neque","integer","sit","amet","justo","sed","elit","porta","convallis","a","at","metus","suspendisse","molestie","turpis","pulvinar","nisl","tincidunt","quis","fringilla","enim","lobortis","curabitur","placerat","quam","ac","sem","venenatis","blandit","Pellentesque","habitant","morbi","tristique","senectus","et","netus","et","malesuada","fames","ac","turpis","egestas","nullam","sed","ligula","nisl","nam","ullamcorper","elit","id","magna","hendrerit","sit","amet","dignissim","elit","sodales","aenean","accumsan","consectetur","rutrum",","],i=e.attributes.paragraphs,n=627;isNaN(e.attributes.randomSeed)||(n=Number(e.attributes.randomSeed));var o=e.attributes.wordsPerSentance,u=Math.floor(a(n)()*o)+Math.floor(o/2);n+=1;var l=e.attributes.sentancesPerParagraph;Math.floor(a(n)()*l),Math.floor(l/2);if(!isNaN(i))for(var c=1;c<=Number(i);c++){for(var p="",m=1;m<=Number(l);m++){for(var d=1;d<=u;d++)n+=37,p+=r[Math.floor(a(n)()*o+1)],p+=" ";p=p.trim()+". ",u=Math.floor(a(n)()*o)+Math.floor(o/2)}t.push(s("p",{},p))}var h=e.attributes;return s("div",{},s("p",{className:"paragraphs"},h.paragraphs),s("p",{className:"wordsPerSentance"},h.wordsPerSentance),s("p",{className:"sentancesPerParagraph"},h.sentancesPerParagraph),s("p",{className:"randomSeed"},h.randomSeed),t)}})},function(e,t,r){"use strict";var a=r(0),i=(r.n(a),r(1)),__=(r.n(i),wp.i18n.__),n=wp.element.createElement,s=wp.blocks.registerBlockType,o=wp.components.TextControl;s("cgb/block-lorim-picture-ipsm",{title:__("lorim-picture-ipsm"),icon:"format-image",category:"common",keywords:[__("placeholder image"),__("lorim ipsm image"),__("utility block")],attributes:{pictureWidth:{type:"string",default:80,source:"html",selector:".pictureWidth"},pictureHeight:{type:"string",default:80,source:"html",selector:".pictureHeight"}},edit:function(e){var t=(e.attributes,e.setAttributes);return n("div",{className:e.className},n(o,{label:"Picture Width?",value:e.attributes.pictureWidth,onChange:function(e){t({pictureWidth:e})}}),n(o,{label:"Picture Height?",value:e.attributes.pictureHeight,onChange:function(e){t({pictureHeight:e})}}))},save:function(e){var t=e.attributes;return n("div",{},n("p",{className:"pictureWidth"},t.pictureWidth),n("p",{className:"pictureHeight"},t.pictureHeight),n("img",{src:"https://picsum.photos/"+t.pictureWidth+"/"+t.pictureHeight}))}})}]);1 !function(e){function t(a){if(r[a])return r[a].exports;var i=r[a]={i:a,l:!1,exports:{}};return e[a].call(i.exports,i,i.exports,t),i.l=!0,i.exports}var r={};t.m=e,t.c=r,t.d=function(e,r,a){t.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:a})},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=2)}([function(e,t){},function(e,t){},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});r(3),r(4)},function(e,t,r){"use strict";function a(e){return function(){return(e=1e4*Math.sin(e))-Math.floor(e)}}var i=r(0),n=(r.n(i),r(1)),__=(r.n(n),wp.i18n.__),s=wp.element.createElement,o=wp.blocks.registerBlockType,u=wp.components.TextControl;o("cgb/block-lorim-ipsm",{title:__("lorim-ipsm"),icon:"text",category:"common",keywords:[__("placeholder text"),__("lorim ipsm block"),__("utility block")],attributes:{paragraphs:{type:"string",default:1,source:"html",selector:".paragraphs"},wordsPersentence:{type:"string",default:24,source:"html",selector:".wordsPersentence"},sentencesPerParagraph:{type:"string",default:5,source:"html",selector:".sentencesPerParagraph"},randomSeed:{type:"string",default:627,source:"html",selector:".randomSeed"}},edit:function(e){var t=(e.attributes,e.setAttributes);return s("div",{className:e.className},s(u,{label:"How many paragraphs of lorem ipsum?",value:e.attributes.paragraphs,onChange:function(e){t({paragraphs:e})}}),s(u,{label:"Max words per sentence?",value:e.attributes.wordsPersentence,onChange:function(e){t({wordsPersentence:e})}}),s(u,{label:"Max sentences per paragraph?",value:e.attributes.sentencesPerParagraph,onChange:function(e){t({sentencesPerParagraph:e})}}),s(u,{label:"Seed for random ipsm generation?",value:e.attributes.randomSeed,onChange:function(e){t({randomSeed:e})}}))},save:function(e){var t=[],r=["lorem","ipsum","dolor","sit","amet","consectetur","adipiscing","elit","donec","nec","nulla","vitae","lacus","mattis","volutpat","eu","at","sapien","nunc","interdum","congue","libero","quis","laoreet","elit",",","sagittis","ut","pellentesque","lacus","erat","dictum","condimentum","pharetra","vel","malesuada","volutpat","risus","nunc","sit","amet","risus","dolor","etiam","posuere","tellus","nisl","Integer","lorem","ligula","tempor","eu","laoreet","ac","eleifend","quis","diam","proin","cursus","nibh","eu","vehicula","varius","lacus","elit",",","eleifend","elit","eget","commodo","ante","felis","at","neque","integer","sit","amet","justo","sed","elit","porta","convallis","a","at","metus","suspendisse","molestie","turpis","pulvinar","nisl","tincidunt","quis","fringilla","enim","lobortis","curabitur","placerat","quam","ac","sem","venenatis","blandit","Pellentesque","habitant","morbi","tristique","senectus","et","netus","et","malesuada","fames","ac","turpis","egestas","nullam","sed","ligula","nisl","nam","ullamcorper","elit","id","magna","hendrerit","sit","amet","dignissim","elit","sodales","aenean","accumsan","consectetur","rutrum",","],i=e.attributes.paragraphs,n=627;isNaN(e.attributes.randomSeed)||(n=Number(e.attributes.randomSeed));var o=e.attributes.wordsPersentence,u=Math.floor(a(n)()*o)+Math.floor(o/2);n+=1;var l=e.attributes.sentencesPerParagraph;Math.floor(a(n)()*l),Math.floor(l/2);if(!isNaN(i))for(var c=1;c<=Number(i);c++){for(var p="",m=1;m<=Number(l);m++){for(var d=1;d<=u;d++)n+=37,p+=r[Math.floor(a(n)()*o+1)],p+=" ";p=p.trim()+". ",u=Math.floor(a(n)()*o)+Math.floor(o/2)}t.push(s("p",{},p))}var h=e.attributes;return s("div",{},s("p",{className:"paragraphs"},h.paragraphs),s("p",{className:"wordsPersentence"},h.wordsPersentence),s("p",{className:"sentencesPerParagraph"},h.sentencesPerParagraph),s("p",{className:"randomSeed"},h.randomSeed),t)}})},function(e,t,r){"use strict";var a=r(0),i=(r.n(a),r(1)),__=(r.n(i),wp.i18n.__),n=wp.element.createElement,s=wp.blocks.registerBlockType,o=wp.components.TextControl;s("cgb/block-lorim-picture-ipsm",{title:__("lorim-picture-ipsm"),icon:"format-image",category:"common",keywords:[__("placeholder image"),__("lorim ipsm image"),__("utility block")],attributes:{pictureWidth:{type:"string",default:80,source:"html",selector:".pictureWidth"},pictureHeight:{type:"string",default:80,source:"html",selector:".pictureHeight"}},edit:function(e){var t=(e.attributes,e.setAttributes);return n("div",{className:e.className},n(o,{label:"Picture Width?",value:e.attributes.pictureWidth,onChange:function(e){t({pictureWidth:e})}}),n(o,{label:"Picture Height?",value:e.attributes.pictureHeight,onChange:function(e){t({pictureHeight:e})}}))},save:function(e){var t=e.attributes;return n("div",{},n("p",{className:"pictureWidth"},t.pictureWidth),n("p",{className:"pictureHeight"},t.pictureHeight),n("img",{src:"https://picsum.photos/"+t.pictureWidth+"/"+t.pictureHeight}))}})}]); -
lorim-ipsm/trunk/dist/blocks.style.build.css
r2313806 r2313849 1 .wp-block-cgb-block-lorim-ipsm .paragraphs{display:none}.wp-block-cgb-block-lorim-ipsm .wordsPer Sentance{display:none}.wp-block-cgb-block-lorim-ipsm .sentancesPerParagraph{display:none}.wp-block-cgb-block-lorim-ipsm .randomSeed{display:none}.wp-block-cgb-block-lorim-picture-ipsm .pictureWidth{display:none}.wp-block-cgb-block-lorim-picture-ipsm .pictureHeight{display:none}1 .wp-block-cgb-block-lorim-ipsm .paragraphs{display:none}.wp-block-cgb-block-lorim-ipsm .wordsPersentence{display:none}.wp-block-cgb-block-lorim-ipsm .sentencesPerParagraph{display:none}.wp-block-cgb-block-lorim-ipsm .randomSeed{display:none}.wp-block-cgb-block-lorim-picture-ipsm .pictureWidth{display:none}.wp-block-cgb-block-lorim-picture-ipsm .pictureHeight{display:none} -
lorim-ipsm/trunk/readme.txt
r2313811 r2313849 1 1 Name: Lorim Ipsm 2 2 Author: Michael LaPan 3 Tested up to: 5.5 3 4 License: GPL2+ 4 5 License URI: https://www.gnu.org/licenses/gpl-2.0.txt … … 7 8 8 9 Lorim ipsm block - 9 Input your options and it will randomly generate a lorim ipsm paragraphs. Pseudo random is used for generating the sentances. Changing the seed will change the sentance.10 Input your options and it will randomly generate one or more lorim ipsm paragraphs. Pseudo random is used for generating sentences. Changing the seed will change the sentence. 10 11 11 12 Lorim picture block - -
lorim-ipsm/trunk/src/block/block.js
r2313806 r2313849 49 49 selector: '.paragraphs', 50 50 }, 51 wordsPer Sentance: {51 wordsPersentence: { 52 52 type: 'string', 53 53 default: 24, 54 54 source: 'html', 55 selector: '.wordsPer Sentance',55 selector: '.wordsPersentence', 56 56 }, 57 sent ancesPerParagraph: {57 sentencesPerParagraph: { 58 58 type: 'string', 59 59 default: 5, 60 60 source: 'html', 61 selector: '.sent ancesPerParagraph',61 selector: '.sentencesPerParagraph', 62 62 }, 63 63 randomSeed: { … … 73 73 el( 'div', { className: props.className }, 74 74 el( TextControl, { 75 label: 'How many paragraphs of lorem ipsum? ',75 label: 'How many paragraphs of lorem ipsum? ', 76 76 value: props.attributes.paragraphs, 77 77 onChange: ( value ) => { … … 80 80 }), 81 81 el( TextControl, { 82 label: 'Max words per sent ance?',83 value: props.attributes.wordsPer Sentance,82 label: 'Max words per sentence?', 83 value: props.attributes.wordsPersentence, 84 84 onChange: ( value ) => { 85 setAttributes( { wordsPer Sentance: value } );85 setAttributes( { wordsPersentence: value } ); 86 86 } 87 87 }), 88 88 el( TextControl, { 89 label: 'Max sent ances per paragraph?',90 value: props.attributes.sent ancesPerParagraph,89 label: 'Max sentences per paragraph?', 90 value: props.attributes.sentencesPerParagraph, 91 91 onChange: ( value ) => { 92 setAttributes( { sent ancesPerParagraph: value } );92 setAttributes( { sentencesPerParagraph: value } ); 93 93 } 94 94 }), … … 141 141 } 142 142 143 let wordsPer Sentance = props.attributes.wordsPerSentance144 let wordsVarance = Math.floor((seededRandom(seed)() * wordsPer Sentance)) + Math.floor(wordsPerSentance / 2)143 let wordsPersentence = props.attributes.wordsPersentence 144 let wordsVarance = Math.floor((seededRandom(seed)() * wordsPersentence)) + Math.floor(wordsPersentence / 2) 145 145 146 146 seed += 1; 147 147 148 let sent ancesPerParagraph = props.attributes.sentancesPerParagraph149 let sent anceVarance = Math.floor((seededRandom(seed)() * sentancesPerParagraph)) + Math.floor(sentancesPerParagraph / 2)148 let sentencesPerParagraph = props.attributes.sentencesPerParagraph 149 let sentenceVarance = Math.floor((seededRandom(seed)() * sentencesPerParagraph)) + Math.floor(sentencesPerParagraph / 2) 150 150 151 151 if (!isNaN(paragraphs)) { 152 152 for (var i = 1; i <= Number(paragraphs); i++) { 153 let sent ance = '';154 for (var k = 1; k <= Number(sent ancesPerParagraph); k++) {153 let sentence = ''; 154 for (var k = 1; k <= Number(sentencesPerParagraph); k++) { 155 155 for (var j = 1; j <= wordsVarance; j++) { 156 156 seed += 37; 157 sent ance += ipsmText[Math.floor((seededRandom(seed)() * wordsPerSentance) + 1)]158 sent ance += ' '157 sentence += ipsmText[Math.floor((seededRandom(seed)() * wordsPersentence) + 1)] 158 sentence += ' ' 159 159 } 160 sent ance = sentance.trim() + '. '161 wordsVarance = Math.floor((seededRandom(seed)() * wordsPer Sentance)) + Math.floor(wordsPerSentance / 2)160 sentence = sentence.trim() + '. ' 161 wordsVarance = Math.floor((seededRandom(seed)() * wordsPersentence)) + Math.floor(wordsPersentence / 2) 162 162 } 163 ipsm.push(el( 'p', {}, sent ance ))163 ipsm.push(el( 'p', {}, sentence )) 164 164 } 165 165 } … … 167 167 return el('div', {}, 168 168 el( 'p', {className: 'paragraphs'}, attributes.paragraphs ), 169 el( 'p', {className: 'wordsPer Sentance'}, attributes.wordsPerSentance ),170 el( 'p', {className: 'sent ancesPerParagraph'}, attributes.sentancesPerParagraph ),169 el( 'p', {className: 'wordsPersentence'}, attributes.wordsPersentence ), 170 el( 'p', {className: 'sentencesPerParagraph'}, attributes.sentencesPerParagraph ), 171 171 el( 'p', {className: 'randomSeed'}, attributes.randomSeed ), 172 172 ipsm -
lorim-ipsm/trunk/src/block/style.scss
r2313806 r2313849 11 11 display:none; 12 12 } 13 .wp-block-cgb-block-lorim-ipsm .wordsPer Sentance {13 .wp-block-cgb-block-lorim-ipsm .wordsPersentence { 14 14 display:none; 15 15 } 16 .wp-block-cgb-block-lorim-ipsm .sent ancesPerParagraph {16 .wp-block-cgb-block-lorim-ipsm .sentencesPerParagraph { 17 17 display:none; 18 18 }
Note: See TracChangeset
for help on using the changeset viewer.