Facebook Page Plugin set active tab - javascript

Is there a way to set the active tab for a facebook page plugin with multiple tabs ? (timeline,messages,events)
The docs don't mention anything about any endpoints and the html structure doesn't have any static id's or classes.
Something like fb_page.setActiveTab('messages'); would be amazing but from what I've searched so far, there's nothing as such.

No, there is no such method available.
The plugin however seems to respect the order in which you supply the tabs you want to show - the first one you mention is always the active one, placed on the very left (at least in LTR languages).
So you could replace the plugin instance with a new one, that has the tabs parameter filled with tab names in the “right” order, to kind-of achieve the effect. (Since that will switch the order of tabs the user sees, it might not be the best idea though, could get confusing.)
Also, this behavior does not seem to be documented - so it might stop working this way at any time.

Related

Word ribbon customization of native Office commands

I'm trying to figure out if it's possible to customize Ribbon in Word programatically using Word JavaScript API. I went through the documentation and couldn't figure it out. I'm also curious if it's even possible right now.
What I'd like to achieve is to disable one of the items within Revision Tab. There's a property on the Office object called Office.ribon, which provides requestUpdate(input) method, which should enable this kind of functionality. Although it looks like the RibbonApi is not fully supported yet in Word as stated in the documentation. https://learn.microsoft.com/en-us/office/dev/add-ins/reference/requirement-sets/ribbon-api-requirement-sets
Is there any alternative how to achieve this goal? It might be possible to do it in manifest.xml, but I'm not sure how to get the specific ID of that item. Only IDs of those top-level Tabs are documented, but not their buttons, dropdowns, etc. It also looks like it's only possible to customize only my own custom items, where I specify the ID by myself. Is it also possible to edit a state of those native Office components, like disabling a button within a Tab?
It seems like a basic operation which could already be a part of the API. Can anybody confirm that it's really impossible to do it so far or is there some kind of a workaround at least?
Thank you.
There is currently no way to programmatically change the ribbon in Word. We are working on enhanced ribbon customization, but I would not expect them to be available in Word before mid-2021 and they may not include the option of disabling a built-in ribbon button.

is there a way to change elements of a page before opening it

I have designed a page to be used as a tool. I am getting some challenges here since my experience is very little in the field and im only new.
- my goal is to change values of an element on a page that is not open yet.
- is there a function i can make on current page to change the values of the element on the next page to preset it to some static numbers or some of them are dynamic
I dont know how to manipulate something that is not open yet, i dont even know if that's something possible. I was able to change elements on my open current page, but dont know how to change something on the next page if i click on one of the links
Park Property Management
Millgate Manor
Weston Towers
Kingston
Region Of Peel
so i expect to click on one of the links and when the link opens some elements in the links i need them to be filled with some values that are static always
You can't directly influence the content of another page with JavaScript in the current page. That would have very big security concerns.
However, you could indirectly influence the content if you have access to the source for both pages, and can add JavaScript to both of them. Then, as some comments suggested, you can for example use search paramaters in the link url to pass along information.
(Search parameters are the stuff that comes at the end of a url sometimes and looks something like ?name=john&id=555)
You can read more about about working with search parameters in JavaScript here:
https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams
Don't get discouraged! You're capabilities will grow as you try to make things work. (That's almost the only time they will grow.)
A word of caution!
Please be very careful when using search parameters to modify or display content on a page as there are some real security concerns involved. Never display anything from the search parameters directly on the page without validating the input first. A good way to handle dynamic content based on search parameters, at least if you know the possible options available, is to have some if .. else statements or maybe a switch block that you try to match the search parameters against, and simply not display anything at all if the content of the parameter does not match any input that you're expecting.

Masking URL for window.print()

So I've scoured the internet for a way to hide the url at the bottom of a page printed using window.print, and it seems the only way to do it is for the user to disable the option in their page settings.
Not ideal, I'm trying to hide the address to our serviceNOW instance from being printed on a form that will be given to our clients customers.
So with hiding it out of the question is there a way I can mask it to say something other than the actual url?
I'm not sure but I think solution 3 here is doing something like this
http://www.codeproject.com/Questions/424312/Can-anyone-help-me-to-hide-Header-Footer-and-Page
But I don't understand that at all.
Is it possible to fool the print dialog into thinking we are on a different page without actually redirecting?
btw I don't see it being useful for this solution but I cannot use jQuery (so many things would have been easier if I could) for some reason it will not work in our ServiceNOW instance.

How do I handle a large amount of user comments being displayed in a long list down a page using JQuery?

I'm wondering if doing this along in JQuery would be stable enough? or if it would need to be done in ruby/rails first?
Either way I don't want a butt load of messages being loaded when a user enters the page where they're displayed. What I want is limit results to a specific amount then either have the page load more results when a user scrolls down or have them click a "load more" button similar to how it's done on both facebook and googleplus.
Currently I have comments scrolling down my page for miles and would like to use jQuery to take control of this. I'm guessing since each comment is stored in a div / class I could use this as a way of recognising what a comment is.
Anyway trying to figure out the best way to approach this I'd really appreciate some advice and maybe links to some good tutorials on how to pull this off.
I agree with the Ohgodwhy's comment - use will_paginate in Rails.
However, I'd also look at how to do scroll-down pagination, rather than page number links, depending on your design. I like Ryan Bates's screencast on this topic: http://railscasts.com/episodes/174-pagination-with-ajax
He also has a video for doing it without will_paginate: http://railscasts.com/episodes/114-endless-page (the newer, revised version of this requires a subscription).

Is there a way of adding a LOT of Facebook like buttons to a page?

I've tried using the standard Facebook like button. I require about 50 like buttons (that number may grow) on my page. The problem is that the second I add more than a few, it drastically slows down my page. If I show all 50 like buttons, the page is practically unoperable, the browser refuses to scroll, freezes and gives "Not responding" warnings etc.
I assume this is because the like buttons weren't made to be displayed multiple times on one page, and it does a LOT of redundant work for every added button. I've seen it be done though, so I'm wondering: is there some special way of displaying lots of Facebook like buttons on one page? I'm talking tens, perhaps hundreds.
Thanks
There are two ways I would recommend doing this. One is to render a fake Facebook button (static image) and then on hover, dynamically load the real Facebook like button to replace the image. The other is to use one of the various jquery scrolling plugins to load the Facebook like buttons as the content becomes visible on the page. TechCrunch.com has lots of like buttons on their home page without performance issues (they are doing the second option I listed).
I think you must implement your own FB link, example:
<a href="http://www.facebook.com/share.php?u=your-url" class="someFBClass" ><span class=icon></span> Facebook</a>
real example
You have to add some css to make the link look FB link.
You can do this by doing using the FB.XFBML.parse method.
http://developers.facebook.com/docs/reference/javascript/FB.XFBML.parse/
This allows you to render the like as and when you need them, each just the one in the veiwport.
Also to make sure, your not loading the facebook javascript SDK (the old XFBML way) for each like button?

Categories

Resources