How to scroll down inside followers popup on Instagram? - imacros

How can i properly use scroll function inside Instagram popup.
I used js function to scroll , which didnt worked
window.scrollBy(0,800);
via Imacros
EVENT TYPE=KEYPRESS SELECTOR="HTML>BODY" KEY=34
As well before scroll event used to click between users to make popup active and then used scroll, before it worked but for now it's not.
Is there any proper way to scroll inside popup?

I think the following command may be helpful:
EVENT TYPE=KEYPRESS SELECTOR="div.j6cq2" KEY=34

This works for me in 2019... Don't change anything!
FList = driver.find_element_by_css_selector('div[role=\'dialog\'] ul')
numberOfFollowersInList = len(FList.find_elements_by_css_selector('li'))
FList.click()
actionChain = webdriver.ActionChains(driver)
time.sleep(random.randint(2,4))
while (numberOfFollowersInList < max):
actionChain.key_down(Keys.SPACE).key_up(Keys.SPACE).perform()
numberOfFollowersInList = len(FList.find_elements_by_css_selector('li'))
time.sleep(0.4)
print(numberOfFollowersInList)
actionChain.key_down(Keys.SPACE).key_up(Keys.SPACE).perform()
time.sleep(1)

Related

How to hide Bootstrap 5 modal programatically in react?

How to hide Bootstrap 5 modal programmatically in React?
I have tried this:
const myModal = document.getElementById("dis-approve-modal");
myModal.hide();
but it says "hide is not a function".
i'm sure this not the right way to do it -via HTML element properties-
but if you want to do it this way try
myModal.hidden = true;

Setting session variable on click

I've got a popup message with a close button at the top. If the user clicks the close button, they should never see the message again while on the site. If they don't click the close button, they will see it on the top of each page on the site.
When the user clicks the close button, I want to set request.session['promo'] to 0. On subsequent page loads on the site, if request.session['promo'] == 0, I will not show the popup message.
What is the best way of setting a session variable on click in django?
Thanks for the direction!
In HTML OnClick of button just call a function in views.py
Ex:
IN HTML :<Button onclick={% your_fucntion %}></button>
IN VIEWS.PY :
def your_fucntion(request):
request.session['promo'] == 'your_variable'
for getting variable :
promo = request.session['promo']

Bootstrap Modal select dropdown expanding outside window

I currently have a select dropdown which is expanding outside the modal window. Is it a better design to increase the window height and keep the dropdown inside it ? ( in which case how to do it ?)
or better keep using this current design ?
in your CoffeeScript you can grab the click event of your dropdown, and reset the height of your modal window:
toggleModalHeight = ->
$('#your_drop_down').on 'click', (event) ->
$('#modal_id').css('height','new height here')
$(document).ready toggleModalHeight
#For avoid Turbolinks issues
$(document).on 'page:load', toggleModalHeight
Within the toggleModalHeight function you can even calculate the new height of your modal and set it properly. Hope have helped you.

Shinyjs: On click option in shiny dashboard

I have a shiny dashboard app with 3 tabs and a notification menu. I am trying to track user activity on the dashboard and wish to log each of their clicks on the dashboard.
The code in server.R for the tabset panel is as below:
output$tabs1=renderUI(
tabsetPanel(type="tab",
tabPanel(id="OverallTab","Overall Activity"),
tabPanel(id="Tab1","Tab 1 details"),
tabPanel(id="Tab2","Tab 2 details"))
Part of my notification code is as below:
output$notiMenu <- renderMenu({
all_nots <- apply(u_notd, 1, function(row) {
notificationItem(text = row[["notification"]], icon("users"))
})
dropdownMenu(type = "notifications", .list = all_nots)
})
I am trying to use shinyjs to write to a dataframe if a user clicks on either of the tabs or notification menu as below:
tab1_clicled=""
tab2_clicked=""
noti_clicked=""
shinyjs::onclick("notiMenu",print("Notification clicked"),noti_clicked="YES")
shinyjs::onclick("Tab1",print("Tab1 clicked"),tab1_clicled="YES")
shinyjs::onclick("Tab2", print("Tab2 clicked"),tab2_clicled="YES")
df=as.data.frame(tab1_clicked,tab2_clicked,noti_clicked)
I face 2 issues here,
1) the on click option doesn't appear to work for the tab panels, using the shinyjs reference(here), I see that there is only a mention of using on click for the tabset panel and not for each tab panel?
2) I'm unable to modify the value of tab1_clicked inside the onclick function. It throws an error saying: Unhandled error in observer: unused argument (tab1_clicled = "YES")
Appreciate any help.
I just quickly skimmed your code and I can see two errors. The first parameter of onclick is the ID of the element. In your case, you want the ID of the actual tab button, but unfortunately the way tabs work in shiny, "Tab1" is actually the ID of the container of the tab panel but it's not the id of the tab button itself. Look at the HTML of a shiny app and you'll see that. Tabs are a bit weird and annoying and it's really difficult to deal with the tab buttons themselves in shiny.
Secondly, The second argument of onclick is the expression, but you're trying to run two expressions print("Tab1 clicked") and tab1_clicled="YES". You need to wrap these in {} so that it's considered one expression, like this:
onclick(id, {print("Tab1 clicked"); tab1_clicled="YES"}
But unfortunately getting the id of the tab button is difficult so I don't think onclick will be useful for that

Foundation Reveal Modal and HTML5 history API manipulation

I am trying to solve an issue with modals. What I want to do is allow the user to click the browser's back button to dismiss a modal and return to the original state of the page, this is: without modal. For such purpose I thought about using HTML 5 history API.
I started trying to append a querystring parameter to the URL, such as http://...page.html?show_modal=[yes|no] but I ended leaving this approach because I couldn't handle all the stuff involving popstate event, pageshow event, etc. I couldn't make it work and it overwhelmed me.
Then I tried with a more simple approach involving a hash appended to the URL, such as http://...page.html#modal, and the hashchange event. This approach is working better for me and I almost have it.
When the user clicks the button to show the modal, he or she can click the browser's back button and it will dismiss the modal. Furthermore, after that, the user can click the browser's forward button and it will show the modal again. Very nice! The user can also navigate directly to the URL with the hash to access directly this state of the page, as well as he or she can bookmark such state of the page. It's working pretty neat and I'm rather happy with the results.
The problem is that it is not working totally perfect. When the user dismiss the modal by clicking the background, the ESC key or the X in the upper right corner, the history starts to mess up. Try it: open the modal by clicking on the button, then click the background to dismiss it (look a the URL in the address bar, first problem here is that the hash isn't removed), then click your browser back button and you will see it isn't working correctly. You will end with a duplicate in your history and you have to click the back button twice in order to go to the previous page. This is not desirable from an UX viewpoint. Does anyone know a solution to this?
I provide my code in this CodePen and at the end of this question. I suggest trying it in your own machine and NOT IN Codepen, so you can view the hash in the URL, etc. Also, it doesn't work in Codepen Full mode, I don't know why.
Thanks!!
I am using Foundation 5.2.1
HTML
<div class="row">
<div class="small-12 columns">
<h1>Reveal Modal</h1>
<h2>Manipulation of the browser history for a better UX</h2>
<a class="button radius" href="#" data-reveal-id="sampleModal" id="button">Show Modal...</a>
</div>
</div>
<!-- ############# -->
<!-- MODAL -->
<!-- ############# -->
<div id="sampleModal" class="reveal-modal medium" data-reveal>
<h2>Hi!</h2>
<p>You may think you are on a new page now, but you aren't. Try to click your browser <kbd>Back</kbd> button to dismiss this modal and return to the the page you were viewing.</p>
<a class="close-reveal-modal">×</a>
</div>
JavaScript
function setModalHash(url, present) {
var a = $('<a>', { href:url } )[0]; // http://tutorialzine.com/2013/07/quick-tip-parse-urls/
var newHash = "";
if (present === true) {
newHash = "#modal";
}
// Build the resulting URL
result = a.protocol + "//" + a.hostname + ":" + a.port + a.pathname + a.search + newHash;
return result;
}
$("#button").on('click', function() {
history.pushState(null, null, setModalHash(document.URL, true));
});
$(window).on("hashchange load",function(e) {
// Handling also the load event allows navigation directly to http://host/path/to/file#modal and bookmarking it
if (document.location.hash == "#modal") {
$("#sampleModal").foundation("reveal","open");
}
else {
$("#sampleModal").foundation("reveal","close");
}
});
I've been messing with the history api/History.js in combination with session storage to maintain modal state, and open/close based upon user navigation. I've finally achieved about 90% of my goal, but history is implemented very poorly in Safari and iOS Safari so remove the features for these browsers.
Some of the problems you may be running into with the hash approach is that when you use the # with pushstate it actually doesn't push a new object into the history state. It sometimes seems to push history onto the stack and you could use history.back() to fire a popstate, but if you were to say refresh the page with your hashurl and do some sort of check for hash on page initiation, there doesn't seem to be a new history pushed onto the stack, and therefore on backwards navigation the user will leave the site rather than closing the modal.
Here is my implementation working for all browsers except for where it falls back to normal behavior is Safari:
http://dtothefp.github.io/hosted_modal_history_sample/
https://github.com/dtothefp/html5history_express_modal_toggle
Like I said I use History.js in combination with sessionstorage because annoyingly enough, in the popstate for closing the modal the history object is removed, which is exactly when I would need it. In all a very poorly implemented API.
I don't change the URL because this project does not have a backend, so if I change the URL with no hash, on page refresh the page would not be found. An alternate implementation would be a query string, which will properly update history when used in the pushstate, but ends up being bad UX because if the user closes the modal not using the backwards navigation (i.e. hitting the cancel button or clicking off), removing the query string would result in a page refresh.