Jump to content

Can

Members
  • Posts

    350
  • Joined

  • Last visited

Everything posted by Can

  1. Maybe I missed it but for Less to work you wont need anything else than AIOM and because I'm using this module always it's literally just renaming your .css file to .less processing, minifying and caching in one step I'm mostly using variables and nesting so far... And separated files are also combined by AIOM
  2. sublime text 3 @Horst your link doesn't seem to do what you intended?
  3. Awesome, thank you Robin! It just works! And good note about PW3, I'll add it above and in the gist, too! JS in updated gist contains now two presets "small" (200), "medium" (350) and menu item to remove with entirely I think I'll add a default width to inserted images in the next update..
  4. Fixed (at least half of the "problem") the inline image issue by extending CKEditor's contextmenu. So I added 3 menu items "alignLeft", "alignRight", "removeAlignment" First step, and it's working good. As a second step I wanted to add some preset sizes to the contextmenu like "small", "medium", "large" which would set the img size attribute But it's not yet working, no errors but no changes.. var editor = CKEDITOR.instances.Inputfield_body; editor.on( 'instanceReady', function(e) { if ( editor.contextMenu ) { editor.addCommand('alignLeft', { exec: function (editor) { var element = editor.getSelection().getStartElement(); element.removeClass('align_right'); element.addClass('align_left'); } }); editor.addCommand('alignRight', { exec: function (editor) { var element = editor.getSelection().getStartElement(); element.removeClass('align_left'); element.addClass('align_right'); } }); editor.addCommand('removeAlignment', { exec: function (editor) { var element = editor.getSelection().getStartElement(); element.removeClass('align_left'); element.removeClass('align_right'); } }); editor.addCommand('small', { exec: function (editor) { var element = editor.getSelection().getStartElement().$; console.log(element); element.attributes.width = 100; } }); editor.addMenuGroup( 'HappyImages' ); editor.addMenuItems({ alignLeft : { label : 'Rechts umfließen', command : 'alignLeft', group : 'HappyImages', order : 1 }, alignRight : { label : 'Links umfließen', command : 'alignRight', group : 'HappyImages', order : 2 }, removeAlignment : { label : 'Nicht umfließen', command : 'removeAlignment', group : 'HappyImages', order : 3 }, small : { label : 'klein', command : 'small', group : 'HappyImages', order : 4 } }); } editor.contextMenu.addListener( function( element ) { if ( element.getAscendant( 'img', true ) ) { return { alignLeft: CKEDITOR.TRISTATE_OFF, alignRight: CKEDITOR.TRISTATE_OFF, removeAlignment: CKEDITOR.TRISTATE_OFF, small: CKEDITOR.TRISTATE_OFF }; } }); }); Maybe someone knows why the small command is not working? Other ideas, improvements and any feedback is always welcome
  5. Hola amigos I wrote a little DOMDocument magic (long time ago) which would automatically link images add classes for Magnific Popup set alt tag wrap the whole thing in a figure insert figcaption if image description available and wrap multiple figures in a container think that's it.. So for our articles we only needed to open pwimage popup in cke, choose desired image, set the size and alignment To caption images we use description input from image field It was a nice starting point, and at some point I changed DOMDocument to SmartDOMDocument wrapped the code into TextformatterBlogImages.module.. But I had ideas to simplify the whole process..and due to a problem with the old implementation which broke design (just realised it a week ago, or that it's linked to my Textformatter) I finally took the time and rewrote the whole thing. Problem was that figure is not a valid child of <p> so at least in chrome I ended up with orphaned text and an empty paragraph so the text style differed from the rest.. I'm posting this as a boilerplate/resource/idea, it's really basic..everything is hardcoded and it's not flexible right now.. So there is the Textformatter module and a hook which is placed in my /site/ready.php right now but might be moved somewhere else.. Maybe it can become a proper module..Maybe I find time to do so..but if someone is interested everyone is welcome to grab the code and extend/modify for their own needs Here's a little animated gif screencast (it's shrinked so the quality is not very beautiful..) So what it does right now: TextformatterBlogImages.module: first it replaces double line breaks like <br><br> or <br /><br /> or any other combination with </p><p> (I had such occurences) parses the article for <p> tags using simple_html_dom finds all containing images it extracts the image name stripping image variations gets the corresponding pageimage from images field the image itself will be replaced by markup used with LazySizes JS plugin (https://github.com/aFarkas/lazysizes) Example: <img src="fullImageUrl" srcset="data:image/png;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=" data-srcset="smallUrl smallWidth, medium mediumWidth, full fullWidth" data-sizes="auto" width="fullImageWidth"> data-sizes="auto" works for now but I might replace it by normal sizes markup, manually deciding how images should be chosen width="fullWidth" I read that images with width attribute render faster but I'm not sure if this is true even if the image is downsized by css? then the new image will be linked to full size image link with markup for js modal (wrote my own, but not ready yet) if image class contains "align_left" or "align_right" it will wrap it in span moving classes from img to span if pageimage got a description it'll insert the descr below the img within span in another span the old image will just be replaced by the new span image so it will be in the same place it image is not aligned (or align_center) it wraps the image in figure moving img classes to figure and description will be wrapped in figcaption and the figure will be stuffed in an own container before the paragraph (original image within p will be removed) The figure gets a class landscape or portrait according to the aspect ratio Uh, I added another hook property called Pageimage::cdn so the images will be served directly from assets subdomain (using domain sharding option from AIOM but saving the extra redirect) Then there is another "round" reparsing the article for newly created figure containers adding additional class containing the number of children and another class indicating how many of the images are landscape/portrait for later styling like 2lx1p for 2 landscape and 1 portrait We add rows of 1 to 4 images, not more so my stylesheet contains rules for all possible cases like 1 landscape 2 portraits, 3 landscapes 1 portrait and so on to resize the images so alls images in a row will have the same height and the row will be always as wide as the main container as seen in the gif above Because the textformatter is doing everything for us I added a little clickable area to each image in the image field and a little javascript which inserts an image into body cke field on click at caret position Only thing to do is manually break the line after 4 images (or less) (NOTE: This javascript code inserting the clickable area requires at least PW 3.0.17 with new image field, as mentioned by Robin S below) For inline images I have to modify, I guess, the javascript a little, or maybe I can add another script which adds 3 links to inserted images, which add alignment classes to the image Here you'll find the files (and code snippes) https://gist.github.com/CanRau/662a559a07d6d7c492159d1cd497944f Any questions, ideas, improvements, concerns and other comments are highly appreciated PS: I'm not using it in production yet, just finished the version, I think I need to review all articles first to ensure proper migration, and maybe I add the inline handling to the javascript as mentioned before PPS: If you're interested in using this you should at least cache the textformatter output using WireCache, or TemplateCache or you can of course use ProCache, but I wouldn't recommend using it without any caching mechanism as it would re-do all the work every time someone requests the page.. Un Saludo Can
  6. You have a lazycron running? Maybe there's something going wrong? If you don't find anything wrong but the code is not too important you could comment it out to see if the error still shows up..
  7. Wow, looks good thanks a lot..tried to get some ideas how to do multi-instance from core but couldn't get any clue.. Will try your code as soon as possible Gracias
  8. What do you mean by front-/backend work just fine..where is this error message showing up?
  9. I'm really looking forward to "multi-instance" docs No pushing..just letting everybody know about my interest hehe
  10. Caching over and over again..don't getting it ^^ Took some cache headers from h5bp but in my tests AIOM won't do anything when changing content of one of the files, am I doing something wrong? autoVer from Robin coupled with the cache busting from h5bp works so far.. now I noticed Pragma and Cache-Control are set to no-cache on the request and I have no clue where this is coming from, searched thru all files, checked http-chost.conf and changed php.ini to session.cache_limiter = public (local MAMP) and I read chrome dev tools would say "from cache" for file size, but it's always showing the file size instead and looks like its getting from server not cache.. Any idea?
  11. Just lost my text due to wrong shortcut -.- (maybe auto storing in local storage would be nice ) but anyways.. Now I got you maba. Thanks to you I just notices that my pages weren't working too.. I actually don't really now what fixed the issue and maybe just re-installing could fix it but there is a new Version with some changes you could grab during re-installation process..see changelog in readme for detail Make sure to remember your settings before uninstalling! Please let me know if everything works now. Sorry Manfred for the late response and thank you for the translation! I just stripped the \n for now But it won't be included on your front pages templates so it works only in backend. You can of course reference the version used by PW but you have to do it yourself (or am I missing something?) Moved "Default true" to end of former line.. I have no idea why \n is not working I always used it as it's suggested in the docs and as far as I remember it always worked?! EDIT: 0.1.2 adds minified CSS & JS
  12. good question but no may I ask why? maybe check out those https://processwire.com/talk/topic/9324-hook-to-suppress-setting-of-session-cookie/ https://processwire.com/talk/topic/4756-stop-cookies-being-sent-session-start-for-site/ First I thought I need to provide the possibility to the users to disable cookies..but now I figured soo many pages depend on cookies, and the cookie law seems more about unnecessary data about the user..but as stated in the second thread by Ryan you could use ProCache or own implementation to bypass "everything" (php, mysql) so no cookies will be set..
  13. Thanks to Ryan the language fields on MarkupCookieconsents option work with this patch for devns. So either apply yourself (like I did) or wait for the next release, probably coming on friday. https://github.com/ryancramerdesign/ProcessWire/commit/2fe134b7b059fff023f0f37c7f172a9853c88af2 You only need to update ProcessModule.module from the linked GitHub page, the other fix is as mentioned in the title not needed for the language fields to work.
  14. As far as I know you need to either use Ryan Web-Service module or roll your own API to pull data.. Or wait a little for Multi-Instance support to be fully ready, I've got no clue when this will be, but it's mentioned in some posts about PW3, so probably in a few weeks?! Then you can use PW's own API from Site1 on Site2 and vice versa to share/manage data..
  15. +1 Had the same thought multiple times but never came up with a request in the forums. Maybe if only one template name provided stay on template creation page, as you suggested. If multiple added, either return to overview or go to detail editing of each template one by one. (As far as I remember Drupal has something like this, at least Views were using this for setting up fields or something) But this could be confusing...
  16. Run into same problem recently and could "solve" it using Ryan's $config->sessionName = session_name(); trick. Happened after duplicating a 2.7.2 PW install locally, renamed folder added host settings imported db, changed config-dev.php to new db credentials, up to this point everything works as expected. Then I'm upgrading to 3.0.12 and get the mentioned login problem without any feedback. Already upgraded 2 installs locally to devns without any problems. Would love to know why wire session name is not working anymore, are there any downsides using php's default? Uh, I'm already using db sessions for a while now Saludos
  17. I would say because kixe is not the author so he can't just implement those features in the official release, but if needed before the author can implement or pull a request he can just fork to make his own version
  18. As the normal WireMail uses php's mail() to send mails you can see all possible settings at http://php.net/manual/en/function.mail.php So you in PW it should be $mail->header('Reply-To', 'webmaster@example.com'); Haven't tested it but should do what you want ;-)
  19. Just tried it. Just enable directory traversal in AIOM's module config and then use this path $styles[] = '../../wire/templates-admin/styles/font-awesome/css/font-awesome.min.css';
  20. Thanks for posting this Juergen, just needed a second button, too As far as I know (and for me it works) you don't need to include two buttons just stick to your first code with the class definition inserted like so for example.. $form = $event->return; $buttontext = __("Save and go to page"); $f = $this->modules->InputfieldSubmit; $f->attr("name", "submit_save_minor"); $f->attr("value", $buttontext); $f->class .= ' ui-priority-secondary head_button_clone'; $form->insertAfter($f, $form->get("submit_save")); the class is taking care of the duplication because the upper button/s are clone using jquery, thus "head_button_clone" tells the script to clone this button, too
  21. Guess I need to dig more into it..but still feels like there's aaaalways something better.... Maybe you got time to share some of your enlightenments?
  22. Why aren't they supporting development and browser support of normal html5 css3 things like <picture> and srcset? Instead coming up with yet another html specification seems ... (crazy?) But as benbyf stated it's again about money..
×
×
  • Create New...