Remove "Mark Complete" button on Task Ribbon in Project Web App - windows

I would like to remove the "Mark Task Complete" button from the Task Ribbon on my Project Web App to prevent users from clicking on it. I have been successful in adding a custom JavaScript Web Part to hide the button after a 200 millisecond delay because the JavaScript has to wait for the page to load. However, this not only leads to a bad user experience but also it is not guaranteed that the page will fully load in 200 milliseconds and thus leaves the possibility of the users seeing the button and being able to interact with it. Here is that JavaScript.
<html>
<body>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("li.ms-cui-tt a:eq(1)").trigger("click");
});
window.onload = function(){
setTimeout(function(){
document.getElementById('Ribbon.ContextualTabs.MyWork.Home.Tasks.MarkComplete-Large').style.display = 'none';
}, 200);
};
</script>
</body>
</html>
Is there a way to accomplish the desired affect without using a delay?

You can use CSS for the same result, note that you have to substitute the dot in the class name with \.
It should look a bit like this (In a Scritp Editor Web Part on the Page):
<style type="text/css">
#Ribbon.ContextualTabs.MyWork.Home.Tasks.MarkComplete-Large {
display: none
}
</style>

Related

VBA generated Ajax 7 script won't display a Bing map in my access web browser control

I'm trying to generate Bing map ajax scripts on the fly depending on user selections in an access form. I would like to be able to display the map in an Access web browser control.
The problem is that two identical looking htm files act differently.
Good.htm loads in access, IE, firefox and opera fine.
Auto.htm, the one generated by code, opens in opera, firefox with no bugs in firefly, but not in access. It opens in IE but with the pop-up "Internet Explorer restricted this webpage from running scripts or ActiveX controls". When I click the "Allow blocked content" button it loads fine.
It will not load in access, if I put buttons in they will show, but the map won't.
I wrote a program to check both files for any differences in characters, there are none.
I can copy the script from auto.htm and paste it into good.htm and it will still be good.
One thing I did notice though, is that the properties that windows reports for good.htm, oddly, has "This file came from another computer and might be blocked...". If I click "unblock" then it will no longer work. auto.htm doesn't have that restriction.
I made good.htm by copying the html from "Bing Maps V7 Interactive SDK" and pasting it into a text file, them changing the extension to .htm.
For what it's worh, here's the script
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"enter code here"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>Map view (bounds)</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<script type="text/javascript" src="http://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=7.0"></script>
<script type="text/javascript">
var map = null;
function getMap()
{
var boundingBox = Microsoft.Maps.LocationRect.fromString("42.3262, -83.8191, 42.2322, -83.6713");
map = new Microsoft.Maps.Map(document.getElementById('myMap'),
{credentials: 'my basic developer key',
bounds: boundingBox,
heigth: 590,
width: 850
});
}
</script>
</head>
<body onload="getMap();">
<div id='myMap' style="position:relative; width:850px; height:590px;"></div>
</body>
</html>
You could try adding the "Mark Of the Web":
Http://msdn.microsoft.com/en-us/library/ms537628(v=vs.85).aspx

Mailchimp sign up PopUp does not work

I am trying to implement a signup PopUp from Mailchimp but as it seems, I am not able to make it working! Here's the code:
<html>
<head>
<script src="https://code.jquery.com/jquery-2.1.3.min.js"></script>
<script type="text/javascript" src="http://s3.amazonaws.com/downloads.mailchimp.com/js/signup-forms/popup/embed.js" data-dojo-config="usePlainJson: true, isDebug: false"></script><script type="text/javascript">require(["mojo/signup-forms/Loader"], function(L) { L.start({"baseUrl":"http://mc.us9.list-manage.com","uuid":"146962178e8704d5ccaf9c28f","lid":"e13cc10d95"}) }) </script>
</head>
<body>
<p>This is a test!</p>
</body>
</html>
If I open the html file (locally), it loads but nothing else happen. Also there is no html code embedded what I would expect it to do. Do you have any ideas?
you have to know a couple of things:
this shows your popup on page load (hence no HTML code)
it only shows once since it places a cookie, and if you already saw your popup won't bother you with it again. (try it in private mode in your browser)
Try to add in header this google libraly <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js"></script>

if ajax function is successful display an alert

I have a jsp named home.jsp. On click of "activate now" button in this jsp, a lightbox is being displayed.
This lightbox has 2 buttons "activate" and "remove".
When I click on "activate" button, a service is being activated. On successful activation, page is reloaded and home.jsp is displayed.
Now i want to display an alert when this happens. Can anyone please help me with this?
Your home.jsp page should queue a JavaScript snippet that runs immediately after the page gets loaded (and once it's activated). I recommend using jQuery which will make this a lot easier. Here is a dirty example:
<html>
<head>
...
<script type="text/javascript">
jQuery().ready(window,function(){
alert("your account is activated");
});
</script>
...
</head>
<body>
...

Phonegap online method and window.location

I'm new to phonegap and I'm still trying to understand the basics. I want to make a simple app that when it starts up it checks to see if it has an internet connection and if it does I want it to redirect to a website or load that website in the web view. If it doesn't have an internet connection, then I want it to stay on the app and just display static content.
Here's what I have so far.
<!DOCTYPE html>
<html>
<head>
<title>Online Example</title>
<script type="text/javascript" charset="utf-8" src="cordova-2.1.0.js"></script>
<script type="text/javascript" charset="utf-8">
function onLoad() {
document.addEventListener("deviceready", onDeviceReady, false);
}
// Cordova is loaded and it is now safe to make calls Cordova methods
//
function onDeviceReady() {
document.addEventListener("online", onOnline, false);
}
// Handle the online event example
//
function onOnline() {
window.location.href ="http://google.com";
}
</script>
</head>
<body onload="onLoad()">
</body>
</html>
I also set OpenAllWhitelistURLsInWebView to true.
Does the online event only work if the app was offline then gets called when the app goes back online?
Thanks in advance!
No, Online event is fired when the app starts if internet is connected and it is also called when the app goes from offline to online mode.
If you want to open a external website in phonegap you can add a child browser plugin for the same Or else you can open a website in a embedded webveiw. window.location.href doesn't work in Phonegap.
I don't know whether you are working on iOS or Android so the link for iOS and for Android
Move your wiring up of the online event handler (i.e. this line):
document.addEventListener("online", onOnline, false);
up into your onLoad() function. I found that the online/offline events need to be registered on load, rather than later for some reason.

JWYSIWYG or jHtmlArea within a Jquery Ui Tab

I am not able to get my jwysiwyg and Jhtmlarea text editors to work within an AJAX loaded Jquery UI Tab
Both text editors work when loaded normally.
This loads the tabs on the "View Page"
<script type="text/javascript">
$(function() {
$("#tabs").tabs();
});
</script>
This loads the page via AJAX on the "View Page"
<li>Edit</li>
This loads the Html Area on the "Edit Page"
<script type="text/javascript" charset="utf-8">
$(function(){
$("textarea").htmlarea();
});
</script>
All help would be greatly appreciated.
Tim
because you're injecting the things you're trying to htmlarea-ize into the DOM after the page loads, you have to put your $("textarea").htmlarea() inside the callback function of the ajax call.

Resources