How to extend time of active code highlight in a shiny app? - r

I am working on a Shiny project where the Shiny app contains large amount of code. I want to debug the app's code interactively using:
runApp("ShinyApp.R", launch.browser = TRUE, display.mode = "showcase")
The display.mode = "showcase" argument displays the active code next to the app in my browser and highlights the area where the user interacted with the app. Here is a good example of how this works: https://shiny.rstudio.com/articles/action-buttons.html
Another example of how it can be used is mentioned in this answer: How do I highlight active code in a shiny app?
What I found challenging is that because my app's script contains over 800 lines of code, I am not able to see the highlighting when it occurs (it disappears too fast). As mentioned here: https://shiny.rstudio.com/articles/display-modes.html, the highlighting disappears after a few moments.
My questions are:
Is it possible to increase the time until the highlighted area disappears?
Is there a way to force the side bar to scroll to the area where the highlighting occurs?
Thank you for any suggestions or answers!

Yes and yes, but you have to edit the source code and it's Javascript. The code in need of modification lives in inst/www/shared/shiny-showcase.js. I already made the code changes on my fork of Shiny if you want to start there.
For your first question about highlight duration, this is handled by the JQuery highlight effect on line 112:
// End any previous highlight before starting this one
jQuery(el)
.stop(true, true)
.effect("highlight", null, 5000);
The original is 1600, or 1.6 seconds, so I upped it here to 5 seconds. You can change it to whatever you think is best.
Your second question about scrolling to the active/highlighted code, isn't included in the original script but the ability to do is baked into web elements and called element.scrollIntoView(). I just inserted this bit of code immediately after the highlighting block:
// Scroll to highlighted element
el.scrollIntoView({behavior: 'smooth'});
el is variable name currently pointing to the active code region to highlight.
Here is hosted working demo of the tweaks in action.

Related

CefSharp minimal example - A blank window shows/disappears

I haven't seen any posts concerning this, so perhaps someone can help.
On the minimal example, A blank window opens and immediately disappears only on the first opening of the browser. I'd like a way to suppress this behavior.
To reproduce, change this line of code in the Winforms example:
browser = new ChromiumWebBrowser("www.foxnews.com")
Any ideas?

googleCharts resets in size in Shiny after second load

So I'm using the googleCharts package in my Shiny app and creating a line chart.
I have a function that creates a different kind of main panel with tabsetpanel depending on the options the user selects. The first load works fine, but when I switch options in my app and it loads the main panel page the second time, the chart shrinks in size unless I specify an exact height and width in options.
The interesting part is if I select the options so the main panel that's created doesn't have a chart, then select one that does, it resets and works fine again. So it's almost like some kind of reactive problem where its saving the wrong page size and not doing a full load.
Any ideas on what I could do? Is there a way for me to force a refresh/reload of the mainPanel?
I actually ended up solving this using invalidateLater, but I would appreciate it if there's a different solution too, since the user can see the chart being redrawn with this solution

Altering The Sorting Arrows In an R Shiny tabPanel

I didn't see anything here or in http://shiny.rstudio.com/reference/shiny that seems to hit on this problem.
In an R Shiny tabPanel output, the sorting arrows align with the right side of the search fields at the bottom of the page.
Here's a pretty good example:
http://shiny.rstudio.com/gallery/datatables-options.html
Is there a way to make them align just to the right of the column name text up top?
Alternatively (or possibly both), is there a way to change the color of the arrows?
The default greyish doesn't really stand out. Bonus points to make the up and down arrows different colors.
Doing it directly in RShiny is best, but I could muddle my way through .js or .css if needed.
I'm trying to head off imminent support requests of "the column is sorting wrong" and "I can't see the arrows" before I push into production.
At the bottom of that shiny example you showed they show that you can pass in through the options parameter options to the rendering for the DataTable table, via the shiny::renderDataTable() function.
Hopefully the http://datatables.net/ site has documentation on what you want if it's indeed possible
If you look at Developer Tools on the http://shiny.rstudio.com/gallery/datatables-options.html page maybe you can see what element would need to be changed.

Move the "logged in as" box generated by shinyapps::addAuthorizedUser

I used the function addAuthorizedUser to add password protection to a Shiny app that I deployed on shinyapps.io, as per the instructions here (ctrl+F for "passwords").
It works fine, but it places a small box at the top-right that covers up part of my app. How do I change its location?
I'd like to move it to the top-left instead, but I'm not sure how to do this other than tearing apart the built-in function and building the password system myself. I'd rather not do that. The unpleasant workaround right now is to add an extra couple of line breaks at the top of the page so that there's room for the box.
edit: this might be built into shinyapps.io instead of the app itself, so changing this might be impossible.

TideSDK - Show unread count (Icon Badges)

I intend to create a basic chat program with TideSDK. I was now wondering if it's possible to display new/unread message count in the dock/tray icon. For example, like this dock icon in OSX:
I did a quick search the docs but could not find anything about these so-called icon badges. Is this correct? My second thought was to update the entire dock/tray icon with a manually redrawn version to simulate badges. However, while I found API functions to update window icons I could also not find a way to update the main app icon.
Any ideas on how I could solve this?
Turns out this was a pretty stupid question. Didn't realise the UI node could also be clicked in the doc navigation tree. The desired functionality is actually built-in. See the relevant doc page here: http://tidesdk.multipart.net/docs/user-dev/generated/#!/api/Ti.UI
You have the following methods to achieve the desired or related result:
Ti.UI.setBadge(txt)
Ti.UI.setBadgeImage(imageURL)
Ti.UI.setDockIcon(icon)

Resources