Advertisement
Guest User

Untitled

a guest
Mar 23rd, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.81 KB | None | 0 0
  1. x.done(function (result) {
  2. // result is an SP.List because that is what we passed to resolve()!
  3. var htmlText = "";
  4. for (var i = 0; i < result.users.length; i++) {
  5. var user = result.users[i];
  6. if (htmlText !== "") { htmlText += "; "; }
  7. htmlText += '<a href="/_layouts/15/userdisp.aspx?ID=' + user.get_id().toString() + '&RootFolder=*">' + user.get_title() + '</a>';
  8. }
  9. // finally! send the result to our callback
  10. return callback(htmlText);
  11. });
  12.  
  13. x.done(function (result) {
  14. // result is an SP.List because that is what we passed to resolve()!
  15. var htmlText = "";
  16. for (var i = 0; i < result.users.length; i++) {
  17. var user = result.users[i];
  18. if (htmlText !== "") { htmlText += "; "; }
  19. htmlText += '<a href="'+_spPageContextInfo.webServerRelativeUrl+'/_layouts/15/userdisp.aspx?ID=' + user.get_id().toString() + '&RootFolder=*">' + user.get_title() + '</a>';
  20. }
  21. // finally! send the result to our callback
  22. return callback(htmlText);
  23. });
  24.  
  25. var changeLink=function(){
  26.  
  27. if($('div.sputility-readonly a').length ===1){
  28. //console.log('href set. clearing interval');
  29. clearInterval(timerInterval);
  30. $('div.sputility-readonly a').each(function(){
  31.  
  32. var oldhref=$(this).attr('href');
  33. //console.log(oldhref);
  34. $(this).attr('href','/sites/site_collection/sub_site'+oldhref);
  35. //console.log('new href '+$(this).attr('href'));
  36.  
  37. });
  38. }
  39. else{
  40. //console.log('href not set yet');
  41. }
  42. };
  43. timerInterval=setInterval(changeLink,100);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement