Remove Recycle Bin from Quick Launch SharePoint 2013 - css

I am scratching my head on this one. I am trying to remove the Recycle Bin from my SharePoint 2013 Site (Microsoft 365). I have spent hours researching and everything I have found hasn't worked. Example 1, Example 2. The most common solution I have gotten has been adding the following to the Master Page via CSS:
<style>
.s4-specialNavLinkList{
display:none;
}
</style>
When I do, nothing. I have even tried viewing it from someones computer who only has view rights, as I read somewhere that those with Admin rights will always see it. I am still new to CSS, but have been working with it enough now that I am able to understand it better. Other manipulations I have done have worked without a hitch (hiding/removing Share/Follow from the Top Menu for example). I've even tried deleting the s4-specialNavLinkList in it's entirety from the script (highlighted text in image) to no avail.
Does anyone know how to properly remove this?

Finally after months of research I was able to find an answer at this site.
The method is inserting the following JavaScript into a script editor web part on each page:
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script><span id="hideMyParentsp"></span><script>$(document).ready(function() { $('#sidebarDiv #hideMyParentsp').parent().parent().hide(); }); </script><script type="text/javascript">window.onload = function(){var x=document.getElementsByTagName("img"); for(var i=0;i<x.length;i++) { if(x[i].title=='Recycle Bin') { var dtag = x[i].parentNode.parentNode.parentNode; dtag.style.visibility='hidden'; } }var xx=document.getElementsByTagName("span"); for(var ii=0;ii<xx.length;ii++) { if(xx[ii].innerHTML=='Recycle Bin') { xx[ii].style.display='none'; } } }; </script>

Related

Change images initial width in a "before and after" wordpress plugin

On my website (which is under construction) I'm using "Before-After MultiX Slider". It's working fine, but I'm trying to have all the separators "collapsed" on the right (or left).
For example here
I've tried to use css to change width of some classes as follows:
.wmg-image.wmg-image-3.first.ui-resizable {
width: 91.6379%!important;
}
.wmg-image.wmg-image-2.ui-resizable {
width: 95%!important;
}
.wmg-image.wmg-image-1.ui-resizable {
width: 98.3621%!important;
}
If I don't use !important nothing happens. If I use it, I get what I want
but the slider stops working and the images don't resize by scrolling separators.
Any idea on how to achieve this?
I can't find any failure there and digged a little deeper into the problem... Therefore I post a second answer, because the nature of the problem is somehow different after all, the code is working but not as expected for the following reason:
If you load scripts async the page will continue to render while the scripts are still loading, so it is possible that other none async scripts comming afterwards will start to load earlier than some async ones still in query...
Here we don't have async ones, BUT it seems to be like even if the async keyword is not present though the scripts will come in the query one after an other depending on their order nevertheless the server will load round about 3 or 4 scripts parallel!
-> So it happens that shorter scripts may be finished to load before longer ones allthough they've started to load later...
On my research I could not find a definite solution for that problem, because it simply seems to be quite hard to control that loading process in detail! (You i.e. can find some topics about that phenomena here on the board...)
I will present some different approaches, you will have to test them yourself, because I don't have that slider PlugIn so I could try:
Solution 1:
Try to use the "defer" keyword, this should be so to say the opposite of "async" and cause scripts to be not loaded before the page is parsed completly, but sadly I'm not sure if that works, never used it before and it sounds like it is the same as using "document.ready" which is not working in this case...
Important thing is that you must insert the script externally otherwise the keyword won't do anything, i.e:
<script src="demo_defer.js" defer></script>
Solution 2:
A surely working solution would be to add our script as a callback to the call of the slider script, but I guess that this is no suitable solution here because you'll have to change the PlugIn code which is not update safe!
Solution 3:
Maybe you can play with a timeout to make sure that the execution will start later, but the problem is that you cannot really know how long this timeout must be! (i.e. have a look here: https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/setTimeout)
WORKAROUND:
I thought up a way to get around that problem, but as said before the code is untested, maybe try that and give me a notice when you have included this script, so I can have a look how it works...
In this way it is supposed that a class which does the positioning with the !important-statement is added and then removed on the first click, just then the elements are positioned again without !important and of course after that on every further click the positioning won't be manipulated again!
function sr_custom_width_for_slides()
{ ?>
<style type="text/css">
.notClicked .wmg-image.wmg-image-3.first.ui-resizable {
width: 91.6379% !important;
}
.notClicked .wmg-image.wmg-image-2 {
width: 95% !important;
}
.notClicked .wmg-image.wmg-image-3 {
width: 98.3621% !important;
}
</style>
<script type="text/javascript">
jQuery( document ).ready(function() {
var firstClicked = false;
jQuery(".wmg-before-after").addClass("notClicked");
jQuery(".wmg-before-after").click(function() {
if ( !firstClicked ) {
jQuery(".wmg-image.wmg-image-3.first.ui-resizable").css("width","91.6379%");
jQuery(".wmg-image.wmg-image-2.ui-resizable").css("width","95%");
jQuery(".wmg-image.wmg-image-1.ui-resizable").css("width","98.3621%");
jQuery(".wmg-before-after").removeClass("notClicked");
firstClicked = true;
}
});
});
</script>
<?php }
add_action( 'wp_footer', 'sr_custom_width_for_slides', 1000 );
EDIT REGARDING YOUR LAST COMMENT:
I checked the site again and in my case it sadly does not work at all, because the click event is never fired! I guess that the JS code of the PlugIn binds some events which maybe stop our script from working... (See the function "stopPropagation()" for more infos.) So my final clue is to simply bind another event which hopefully is not manipulated by the PlugIN in that way! As far as I can see this could be "mouseenter" or "mouseover"...
So just change
jQuery(".wmg-before-after").click(function() {
...
});
to
jQuery(".wmg-before-after").mouseover(function() {
...
});
the problem is quite simple... The width is set inline via js, so this will override any changes you made in your css file!
If you set the styles with an !important-statement it will work, but the sliders script cannot set the new width anymore...
So after all the most easy way to achieve what you want is to insert a small script which sets the styles AFTER the slider scripts have been loaded, so maybe at the very bottom of the footer of the page after the "wp_footer" call, because most plug ins enter their js over this hook, somehow like this:
<script>
jQuery(function() {
jQuery(".wmg-image.wmg-image-3.first.ui-resizable").css("width","91.6379%");
jQuery(".wmg-image.wmg-image-2.ui-resizable").css("width","95%");
jQuery(".wmg-image.wmg-image-1.ui-resizable").css("width","98.3621%");
});
</script>
I can't test it, but I'm quite sure that this will work, if the script is inserted at the correct position! :)
EDIT: I made a quick test via the console of the FF inspector and it works as expected, but as mentioned above, if the slider script will load later than this script it won't work at all!

Posting IPython Notebook in Wordpress

I am trying to convert my IPython notebook to an html file so that I can put it on my wordpress blog. I have used the following command to generate an html file for the notebook
ipython nbconvert notebook.ipynb
then I copied the html code and pasted it into the 'text' tab. The resulting blog post sort of looks like the ipython notebook, however the problem is that the markdown equations do not show up and the headings look strange. Has anyone managed to display an IPython notebook in a wordpress blog post successfully? If so, how?
In this November 2013 blog article http://www.josephhardinee.com/blog/?p=46, the author goes quickly through the conversion process.
He mentions the need to install the Simple Mathjax plugin to make equation display work.
Now, what I have tested to work on my self-hosted Wordpress blog:
Copy paste the html output of nbconvert (only what is inside the <body> tag) in the "Text" tab.
disable the Worpress html code parsing because otherwise images do not display (as explained in the blog post). See below for two possible methods.
Activate Mathjax: either with a plugin or manually in the post code
Mathjax With plugin
I have not tested the Simple Mathjax plugin, but I have LaTeX for WordPress which works for me.
Manual Mathjax activation
Copy paste from nbconvert output the two <script> tags that activate Mathjax:
1) Load the library:
<script src="https://c328740.ssl.cf1.rackcdn.com/mathjax/latest/MathJax.js?config=TeX-AMS_HTML" type="text/javascript"></script>
2) Launch it:
<script type="text/javascript">
init_mathjax = function() {
if (window.MathJax) {
// MathJax loaded
MathJax.Hub.Config({
tex2jax: {
inlineMath: [ ['$','$'], ["\\(","\\)"] ],
displayMath: [ ['$$','$$'], ["\\[","\\]"] ]
},
displayAlign: 'left', // Change this to 'center' to center equations.
"HTML-CSS": {
styles: {'.MathJax_Display': {"margin": 0}}
}
});
MathJax.Hub.Queue(["Typeset",MathJax.Hub]);
}
}
init_mathjax();
</script>
Disabling code HTML parsing
The blog post suggests to activating the PS Disable Auto Formatting plugin to make the notebook images work. I have tested it successfully but it has one drawback: it messes up with the rendering of all the other posts... that's quite an issue!
I have tested instead the Raw HTML plugin which enable a per-post tuning. I've made images work by selecting the Disable automatic paragraphs option (the plugin creates a new box in the post editor).
Remaining issues:
while the notebooks should display fine with this method, there is still work to get the syntax highlighting of code cells to display properly. However the Python source code is already parsed by CodeMirror, so it should just be about loading the appropriate CSS code.
One approach is to embed the notebook using an iframe. This original idea came from the blog post http://onsnetwork.org/eimd/2014/08/08/how-to-enter-ipython-notebooks-to-wordpress/, but I've made several improvements. The straightforward way to do this is to:
Install the Raw HTML plugin to Wordpress. This only needs to be done once.
Convert the notebook to HTML ipython nbconvert YOUR_NOTEBOOK.ipynb
Upload the resulting HTML to Wordpress as a media file. Take note of the URL where it is uploaded to.
Insert the iframe between raw tags in your post. For example:
[raw]
<iframe id="ipython_notebook_frame"
style="height: 500px; width: 100%; padding: 0; border: none;"
src="URL_OF_NOTEBOOK">
</iframe>
[/raw]
Unfortunately, this straightforward approach doesn't work very well since the height is never right and one tends to get annoying horizontal scroll bars. However, since the uploaded html is hosted on the same domain as the blog post, this can be fixed using some javascript. The following recipe seems to work reasonably well for getting the width and height right, resulting in a clean blog post:
[raw]
<script type="text/javascript">
function resizeIframe(ifrm) {
ifrm.style.height = ifrm.contentWindow.document.body.scrollHeight + 'px';
// Setting the width here, or setting overflowX to "hidden"both
// seem to work. It may be that one turns out to be better; for
// now I set the height.
ifrm.style.width = ifrm.contentWindow.document.body.scrollWidth + 'px';
}
</script>
<script type="text/javascript">
function onLoad() {
var ifrm = document.getElementById('ipython_notebook_frame');
setTimeout(resizeIframe, 0, ifrm);
}
</script>
<iframe id="ipython_notebook_frame"
style="height: 500px; width: 100%; padding: 0; border: none;"
src="URL_OF_NOTEBOOK">
</iframe>
<script type="text/javascript">
// By deleting and reinstating the iframe src, and by using setTimeout
// rather than resizing directly we convince Safari to render the
// page. I've lost the link for where I found this trick, so
// can't properly credit it.
var iframe = document.getElementById('ipython_notebook_frame');
iframe.onload = onLoad;
var iSrc = iframe.src;
iframe.src = '';
iframe.src = iSrc;
</script>
[/raw]
For a little more detail on this, as well as an example you can take a look at this post: http://www.bitsofbits.com/2015/01/19/ipython-notebooks-in-wordpress

The nature of JS Bin

Can someone explain why awesome tools like JS Bin give errors like:
Runner: Permission denied to access property 'scrollX'
when I'm trying code like:
<button onClick="exit();">Exit</button>
<script>
function exit() {
window.location = 'http://www.youtube.com/';
}
</script>
...that work fine if they are called from a regular file in the browser?
Thanks.
Edit: Correction Firefox gives the error.
It's because the iframe that the runner (the thing that automatically generates the preview in jsbin) has sandbox'ed properties on it.
It's been set up so that the only thing that the iframe can't do is set the location of the window. This stops someone from sending a malicious bin to another user, and then suddenly redirectly elsewhere.
Similarly, sites like youtube.com prevent their content from being set in an iframe, and such you see a blank window, like this: http://responsivepx.com/?youtube.com (note that the blank window is where youtube.com is supposed to be).
I'm the primary dev on jsbin by the way, which is why I know :)

IE wordpress nav styles perfect when logged in, but not when loggged out

Out of no where, the navigation on site down started acting crazy when viewed in Internet Explorer while not logged in. However, when you log in... everything works perfectly...
I know it must be a stylesheet ordering issue, but I'm not having any luck finding a fix.
You can log in here with the username: bobo and password: bobo to see what I'm talking about.
Thanks in advance for taking a look
--
EDIT
this is the jQuery for the nav:
<script type='text/javascript'>
jQuery(document).ready(function ($) {
$('#access li').each(function(){
$(this).hover(function(){
$('> ul',this).show();
}, function(){
$('> ul',this).hide();
});
});
});
</script>
Figured it out!
I guess wordpress caught a bug when adding a new page to the menu, because after combing through the source code, I noticed one of the links closing li tag was out of place.
Removed that link from the nav. BAM! working perfectly now...
Hope this is able to help someone like me who feels that wordpress is out to get them.

Why is my javascript function not found by the page it is embedded in?

I have a page that has a simple javascript in the header portion of the page:
<script type="text/javascript">
function doLogout() {
var conf = confirm("Really log out?");
if (conf === true) { //changed == to === for boolean comparison
$.post("logout.aspx");
}
}
</script>
It uses jQuery to do an AJAX post to my logout page. The only issue right now is that when I click on the link (logout) to fire this function, nothing happens. I checked FireBug's console, and it told me that the function is not defined. This has happened to me before, but I think I botched a bunch of code to fix it sometimes.
Does anyone know the proper way to fix this issue?
Edit
After doing a lot of googling and trying different things, I found this very concise and informative post. Apparently, as the linked article states, the way the script is referenced in the web site is important as it won't run properly otherwise! Hopefully this information will be useful for more people.
This can also occur if there is a syntax error earlier in your javascript code. Often this will just be interpreted as the function not existing (nor any function AFTER the error). Check the code above this code (if there is any) and this code for syntax errors.
A way to tell if the cache error is it is to open Firebug and view the Script source. If the page was cached, you won't see your code. If it loaded but has syntax errors, the code will show, though it won't "find" it.
Things to test:
1) Can you call this function from something else? Like add a <script> at the bottom of the page to call it?
2) Does the page validate? Sometimes I get screwy javascript errors if there is some busted HTML like a missing </b>
3) I've been starting to wrap my javascript in <![CDATA[ ]]> just incase I've got goofy chars in my javascript.
4) I assume you've tested this in other browsers and have the same behavior, right?
5) If you haven't installed it already, install the Web Developer firefox addon. It has a nifty toolbar menu that will disable the cache for you so everything reloads.
6) As weird as it sounds, I once hit a javascript issue that was because of how my text editor was saving UTF-8 files. I forget the details, but it was adding some byte-order-mark or something that upset the browser.
I've had this occur when the page had been cached and so it didn't load the new script in. So to fix it clear all private data from Firefox. Not sure if that helps but it sure happened to me a bunch.
Other ideas for you to test:
is the function defined in the DOM tab in FireBug?
if you call doLogout() from the FireBug console, what happens?
I assume this is not the only script on that page. Make sure that some later script is not modifying doLogout to something else
I had the same issue and tried all that's been suggested here without success.
The only way I fixed it was by discovering that in the <script src="jquery.js"> tag I was using in the head of the page I forgot to close it with its </script> causing the page to ignore all Javascript functions. So please check that your includes look like:
<script src="jquery.js"></script>
I hope that helps. Ross.
If you are using DevExpress controls these links may help you: How to register and execute a JavaScript downloaded to the client via a callback and How to register and execute a JavaScript downloaded to the client via a callback (standalone JS file) and Executing javascripts from user controls dynamically created through ASPxCallback panels
The issue might occur if you have NoScript. You should check and make sure it's not blocking said script.
I had this issue and discovered the problem was just a wrong case letter inside the name.
Call: filterCheckbox()
vs
function filterCheckBox() {}
problem: lowercase "box" vs uppercase "Box".
So check if the name is exactly the same.

Resources