SharePoint 2016 Copy Shortcut Context Menu

 Computer, Sharepoint, Software  Comments Off on SharePoint 2016 Copy Shortcut Context Menu
Dec 082018
 
Share

After an upgrade from SP2013 to SP2016, the ability to right-click on a document and copying a shortcut was removed. This is because the IE right-click menu has been replaced by a context sensitive menu that does not include an option for copying a shortcut to the document. The following code will put that back…

// Add "Copy Shortcut" option to document context menu
$(document).ready( function () {
// Use setInterval to run this every 100ms
setInterval(
function () {
// Check if a "Copy shortcut" button is already displayed
var n = $('#copyShortcutMenuItem').length;
var m = $('.ms-core-menu-list').length;
if (n == 0 && m > 0) {
var firstMenuItem = $('li.ms-core-menu-item:first-of-type');
var hlink = firstMenuItem.parent().parent().parent().find('div:first-of-type').attr('Url');
if (hlink.startsWith('/')) {
hlink = "https://" + window.location.host + hlink; 
}
// Build the HTML of the new list item
var newHtml = '
 	<li id="copyShortcutMenuItem" class="ms-core-menu-item" type="option" text="Copy Shortcut"><a title="Copy a link to this document to the clipboard" class="ms-core-menu-link" href="#" onclick="CopyShortcutClick(\'' + hlink + '\');">Copy Shortcut</a></li>
';
// Insert the list item
$(newHtml).insertBefore(firstMenuItem);
}
}, 100
);
});
// Set the clipboard and hide the menu
function CopyShortcutClick(t) {
window.clipboardData.setData('Text', t);
$('.ms-core-menu-list').parent().hide();
}

Save this as CopyShortCut.js and put it in your root Site Assets library. Also download the latest JQUERY. Add the following to the <Head> of your master page.

<script type="text/javascript" src="/SiteAssets/jquery-3.1.1.min.js"></script>
<script type="text/javascript" src="/SiteAssets/CopyShortCut.js"></script>
 Posted by at 7:51 am

Party Mode mod for Volumio

 Raspberry PI, Software  Comments Off on Party Mode mod for Volumio
Apr 292017
 
Share

Volumio is a headless audio player for the Raspberry Pi. I am using it as a jukebox with the 7′ LCD display.

I revised some of the code to work the way I wanted as a “party mode.”
1. From the browse window, the default event for clicking on a song is to add it to the queue instead of auto-play.
2. I display a popup message that the song was added to the queue.
3. Give a visual cue of what you clicked on.

Source and documentation can be found on GitHub.

Line rows are basic locations.

/src/app/browse/browse.controller.js
Line 3: Added toastMessageService

modalService, $timeout, matchmediaService, $compile, $document, $rootScope, $log, playerService, toastMessageService) 

Line 18: Added constructor reference:

this.toastMessageService = toastMessageService;

Line 68: Modified clickListItem(item)
Changed

this.play(item)

to…

this.toastMessageService.showMessage('success', item.title+' Added to Queue', 'Queue');
this.playQueueService.add(item);

Line 228: modified itemWrapper div
Changed

this.table += '<div class="itemWrapper"><div class="itemTab">';

to…

this.table += '<div class="itemWrapper" onclick="style.backgroundColor = '#42f4f1'"><div class="itemTab">';

 Posted by at 7:36 am  Tagged with: ,