Today I’m very proud to release the brand new plugin Splitview, an awesome plugin for splitscreen preview.
Splitview on Github
To not repeat myself, read more information on Github:
https://github.com/jenstornell/splitview
Now, flood me with issues, questions, ideas, pull requests and so on. Just be aware that it only works well in Kirby 2.2+.
13 Likes
Splitview 0.2 - Memory edition
Splitview was a success
I got 8 likes here and 3 stars on Github. I mean, 3 stars! That’s a new record!
I’ve been working hard with the new version. It may look very much like the previous version but it has been completely rewritten. It’s really a good base for the future.
Tested with Kirby 2.2.1
Memory
One of the new features is that the splitview remember things between pageloads like orientation (columns / rows), view (split, panel or site) and visible (splitview visible or not on load). It’s invisible but quite useful.
Main view
New things here are icons for panel and site as well as the new orientation switch.
Orientation - Here as rows
Here we can see orientation as rows. The switch is in the upper right corner.
Panel view
Full screen panel view. New here is an icon for the back button, to look more like the panel-bar plugin. A pin function added to pin the admin, leaving the splitview.
For advanced users
There are some stuff for more advanced users like config options. There is also the possibility to send js options to the js splitview function. That can be useful if using an own template with custom options.
Read more here: https://github.com/jenstornell/splitview/blob/development/CHANGELOG.md
More docs needed on the option part. I will update them soon.
6 Likes
This looks really cool! I wanted to add something like this natively for quite a while. Need to check your solution out a bit more closely as soon as there’s more time left.
1 Like
I tried it. It works really great!
1 Like
Splitview 0.3 - Sync
It’s the biggest release so far. In fact, I changed how it works. In version 0.2 splitview was a function that you could use by pressing a keyboard shortcut. You can still do that but it’s not just a function anymore, it’s a tool. It even has an own url.
Benefits of having an own url for the tool
- Back in your browser just works. No fancy javascript needed for it to work as expected.
- CSS problems depending on your site will never appear, as it’s now on an own page with own CSS.
- BEM is no longer needed because it cannot collide with other CSS. It results in much cleaner HTML, CSS and JS.
- Easier to link to Splitview from anywhere.
- The pin buttons are no longer needed. Just a close button that will take you to the right place.
- The script code for triggering the shortcut is much smaller which makes your site faster than before. Most of the code loads on the Splitview page, not on the frontend.
- It does not need to autorefresh on close if page has been saved.
Downsides of having an own url for the tool
- You will be redirected to a new page. This means that it will take about 0.5 seconds to load (depending on your hosting). When working with it, it’s still as fast as before.
Urls
- Urls to tell you where you are on the panel and on the site.
- When clicking links on the panel or on the site the urls update automatically.
- When changing an url and clicking enter, the view will load that page.
Sync
- When clicking the arrow buttons the page is synced to the other view.
- It will figure out the url to the panel when syncing from right to left.
- It will figure out the url to the site when syncing from left to right.
Menu
- New menu system because everything will not fit into the bar in the future.
- Click on “Sync” to try it out.
Options
- Many options are removed as they are not longer needed. The options docs till be updated in time.
- Some new options are added. I will wait with the docs on it in case I change my mind about things.
Save
- There was a bug that when saved two times very fast, the site view was not refreshed. That problem is now solved.
- Panel saved message is disabled.
- Splitview not uses own save and error messages. It fixes a bug and works better visually.
Other changes
- Smaller bar with smaller icons. Not so much waste of screen space.
- Reload is now also available to the panel view, in case it needs to be refreshed.
- When closing on a view with both panel and site, there is a dropdown to choose what you want to close to, the panel or the site.
- When closing on the panel or the site view, Splitview closes to these pages.
- Gulp is now used instead of Prepros for better file structure and more.
Future
I have more ideas now than I had when I first started so there is still much that can be done.
I know that @bastianallgeier is thinking of implementing something similar, but it does not yet exist. Until then or longer I will continue to develop this thing.
1 Like
Splitview 0.4 - Copy
(click to enlarge)
The smallest change might have the biggest impact. With the new little “copy” feature you can use Splitview to compare pages on your own site easily.
Dropdown menus
I never really liked the modal thing in the previous version, so I changed it to more native Kirby dropdown menus.
View + Orientation = View
The “view” and “orientation” modes are now merged into just “view”. There is really no need for them to be set apart.
Menu bar design changes
It might not look like it, but the bar has gone through many stages and much (re)thinking before it was set as it is now.
The menu bars are much more equal than previous versions. The “global” menu is gone.
It’s possible to toggle the menu buttons when need to see more of the address bar (the little arrow button).
Copy
Copy the url to the other view. Now you can now use Splitview to compare pages on your site. Copy will probably make it easier.
Other changes
- Get variables are no longer required when visiting the splitview page by url. If no page slug exists, it will load the home page instead.
- If get variables exists, it will use them if memory are false.
- Many minor fixes and code adjustments made.
- The big splitview.js file is now split into smaller modules for better maintainability.
in wich File i have to Paste The Code , do you think you can send me a Screenshot?
When downloading the ZIP-file from Github you will probably get a file called splitview-master-zip
. That’s how Github names it.
Rename the folder
- Unzip that package. Then you will have a folder called
splitview-master
.
- If there is a folder called
assets
in it, then you are right. In that case rename splitview-master
it to splitview
.
- If there is another
splitview-master
folder inside, then you first need to get it out, and then rename it to splitview
.
Add it to plugins
Setup
I paste it from the github page:
- Download the Splitview plugin
- Put the
splitview
folder in /plugins/. If folder is another name like splitview-master
, rename it to splitview
.
- Add
<?php echo splitview(); ?>
right before </body>
in your footer of all your pages.
- Login to the panel. When logged in, go to the frontend of your site.
- Press
alt + s
to activate the Splitview.
Ask again if it’s unclear.
1 Like
i dont understand The Number 3 in “Setup” do you mean i have to Paste it in the Footer.php??
You probably have a file in your Kirby setup site/snippets/footer.php
. In that file, right before </body>
you should place <?php echo splitview(); ?>
.
That loads a little javascript that make the keyboard shortcut work (alt+s) so you can access the Splitview. (Just be sure to be logged in to the panel)
its not Work , I’m using Google Chrome for Windows
I just installed a fresh installation of both Kirby and Splitview and it works for me. I also use Google Chrome for Windows.
To debug you can do this:
1. Check Kirby version
What version of Kirby are you using? It works with version 2.2 and up.
2. Look at the source code
I use F12 on the keyboard to show the developer toolbar. If the plugin is installed correctly and the function is added in the footer it should look like this. Look for “Splitview # Start”.
3. Check for javascript errors
Maybe you have some javascript error? It can prevent the script from running. It can be checked in the developer toolbar under “Console”. If there are nothing there no errors accur.
4. Check that you are logged in
It’s really important to be logged in to use the Splitview. If not logged in you don’t have access to the Splitview or the panel.
After logged in. Go to the frontend and use the keyboard shortcut.
5. Check that you use the keyboard shortcut
You need to hold down “alt” key and press “s” to get to the Splitview tool. Did you do that? That you need to do on the fronend. It does not yet work from the panel.
1 Like
I have the version 2.2.3, and i Dont have Java Errors, do you think i have that Problem because i have installing it whit GIT??
Splitview 0.5 - Flip
https://github.com/jenstornell/splitview
Main features for this release are Flip button, improved sync and improved address bar. A lot has been done under the hood not visible in the tool, so it might look like a minor release.
Flip in the menu
Refresh button moved to flash menu
Flip
Flip make the views switch place.
Middle click support
Exit click now support middle mouse click. When clicking the left mouse button it exit to the same tab as you are in. On middle click it exit to a new tab (in most browsers). I hope it work on a Mac as well.
Sync improvements
Now it does not matter if you have the panel url in the first or the second view, Splitview detect what is the panel and what is the site. That make the Sync function work much better.
Menu toggle moved / removed
Space is always of value in the address bar. Therefor I moved / removed the toggle button to be more of an invisible feature.
You can still toggle the menu. Just click the address field and it will expand.
Improved address field
- On click the address is now selected, just like any other browser.
- On click the address bar is now expanded so you can see more of the address.
- When address bar is active you can click the arrow button to shrink it again.
- When address bar is active you can press escape key to shrink it as well.
- When pressing enter to go to the url it will shrink after that as well.
- You can still have the address bar in expanded mode while browsing the views. Just don’t press escape or enter when input is active, or click the arrow button.
Too much information? Try it out instead.
Moved reload page button
In the previous version the reload page button was inside the address field container. Now it has been moved to the flash dropdown menu instead.
Reasons behind the decision:
- Waste of space.
- Not often need to refresh as it already does that on save.
- It’s still accessible through the flash menu.
- It’s still accessible by clicking the address bar and hit enter.
Possible future features
- Live preview (a very basic function if implemented)
- Zoom in and out.
- Set width of a view. No need to have the view wider than site max width.
- Distraction free writing.
- Auto sync (not to be confused with autosave which always is active).
- More options.
- More stuff saved to memory.
4 Likes
Getting the following error, both in front and the panel. Windows, WAMP, Chrome.
Fatal error: Can't use function return value in write context in ...wamp\www\test\site\plugins\splitview\core\options.php on line 17
What version of Kirby are you using? I tried it and for me it works, even with no options set.
I added an if statement around the foreach. It should fix that problem, but I don’t know if you will get more related problems down the line.
// Options get replacement
public static function optionsGetReplacement( $keys, $options ) {
$new_options = array();
if( ! empty( $keys ) ) { // Added
foreach( $keys as $key ) {
if( ! empty( get($key) ) ) {
$new_options[$key] = get($key);
} else {
if( isset( $options[$key] ) ) {
$value = $options[$key];
$new_options[$key] = $value;
}
}
}
return $new_options;
} // Added
}
I will release a new version but if you don’t want to wait you can try it. If you are having more problems, write again.