Google DOCS Footer Error – Web Applications Stack Exchange


I got the below script for automatic “last edited” timestamp in the
footer of a Google Document.

function lastEdited() {
  var doc = DocumentApp.getActiveDocument();
  var id = doc.getId();
  var file = Drive.Files.get(id);
  var footerSection = (doc.getFooter())?doc.getFooter():doc.addFooter();
  footerSection.clear();
  var userName = file.lastModifyingUserName;
  var date = file.modifiedDate;
  var text = '(Last edited by ' + userName + ' on ' + Utilities.formatDate(new Date(date), 'GMT+5', 'YYYY/MM/dd hh:mm') + ')';
  var p = footerSection.insertParagraph(0,text);
  p.setAlignment(DocumentApp.HorizontalAlignment.RIGHT);
}

But there is below mentioned error in this

SyntaxError: Unexpected token ‘:’ (line 4, file “Code.gs”)

Can anyone help me in this?