From 3740f8be9d43a874f87a1757857f55d3662f60ff Mon Sep 17 00:00:00 2001 From: mr Date: Mon, 17 Oct 2011 12:30:21 +0200 Subject: change external links to js _blank | remove spaces --- public/javascripts/toxcreate.js | 50 +++++++++++++++++++---------------------- 1 file changed, 23 insertions(+), 27 deletions(-) diff --git a/public/javascripts/toxcreate.js b/public/javascripts/toxcreate.js index 0e82040..ef2a953 100755 --- a/public/javascripts/toxcreate.js +++ b/public/javascripts/toxcreate.js @@ -25,12 +25,12 @@ $(function() { $.each(stati, function(){ checkProgress(this); if(checkStatus(this) > 0) newstati.push(this); - }); + }); if (newstati.length > 0) var statusCheck = setTimeout('checkStati("' + newstati.join(", ") + '")',10000); }; - + checkStatus = function(id) { - if(id == "") return -1; + if(id == "") return -1; var opts = {method: 'get', action: 'model/' + id + '/status', id: id}; var status_changed = $.ajax({ type: opts.method, @@ -43,15 +43,15 @@ $(function() { success: function(data) { var status_before = ""; if ($("span#model_" + id + "_status") != null) status_before = $("span#model_" + id + "_status").html().trim(); - if (status_before == "Deleting") return -1; + if (status_before == "Deleting") return -1; var status_after = data.trim(); $("span#model_" + id + "_status").animate({"opacity": "0.2"},1000); $("span#model_" + id + "_status").animate({"opacity": "1"},1000); if( status_before != status_after) { - $("span#model_" + id + "_status").html(data); + $("span#model_" + id + "_status").html(data); loadModel(id, 'model'); if (status_after == "Completed" || status_after == "Error") id = -1; - } + } }, error: function(data) { //alert("status check error"); @@ -60,8 +60,8 @@ $(function() { }); return id; }; - - + + checkProgress = function(id) { var task = $("input#model_" + id + "_task").attr('value'); var opts = {action: task + "/percentageCompleted" , id: id}; @@ -74,9 +74,8 @@ $(function() { }, success: function(data) { var progress = data.trim(); - if (progress == "100") return -1; - - $("div#model_" + id + "_progress").progressbar("value", parseInt(progress)); + if (progress == "100") return -1; + $("div#model_" + id + "_progress").progressbar("value", parseInt(progress)); $("div#model_" + id + "_progress").attr({title: parseInt(progress) + "%"}); }, error: function(data) { @@ -84,10 +83,10 @@ $(function() { } }); return id; - }; + }; loadModel = function(id, view) { - if(id == "") return -1; + if(id == "") return -1; var opts = {method: 'get', action: 'model/' + id + '/' + view, view: view }; var out = id; $.ajax({ @@ -118,7 +117,7 @@ jQuery.fn.editModel = function(options) { trigger_on: 'click' }; var opts = $.extend(defaults, options); - this.bind(opts.trigger_on, function() { + this.bind(opts.trigger_on, function() { $.ajax({ type: opts.method, url: opts.action, @@ -126,7 +125,7 @@ jQuery.fn.editModel = function(options) { data: { '_method': 'get' }, - success: function(data) { + success: function(data) { $("div#model_" + opts.id + "_name").html(data); $("input#model_" + opts.id + "_name").focus(); }, @@ -145,8 +144,8 @@ jQuery.fn.cancelEdit = function(options) { trigger_on: 'click' }; var opts = $.extend(defaults, options); - - this.bind(opts.trigger_on, function() { + + this.bind(opts.trigger_on, function() { $.ajax({ type: opts.method, url: opts.action, @@ -154,7 +153,7 @@ jQuery.fn.cancelEdit = function(options) { data: { '_method': 'get' }, - success: function(data) { + success: function(data) { $("div#model_" + opts.id + "_name").html(data); }, error: function(data) { @@ -172,9 +171,9 @@ jQuery.fn.saveModel = function(options) { trigger_on: 'click' }; var opts = $.extend(defaults, options); - - this.bind(opts.trigger_on, function() { - var name = $("input#model_" + opts.id + "_name").val(); + + this.bind(opts.trigger_on, function() { + var name = $("input#model_" + opts.id + "_name").val(); $.ajax({ type: opts.method, url: opts.action, @@ -183,7 +182,7 @@ jQuery.fn.saveModel = function(options) { '_method': 'put', 'name': name }, - success: function(data) { + success: function(data) { $("div#model_" + opts.id + "_name").html(data); }, error: function(data) { @@ -215,7 +214,7 @@ jQuery.fn.deleteModel = function(type, options) { data: { '_method': 'delete' }, - success: function(data) { + success: function(data) { $("div#model_" + opts.id).fadeTo("slow",0).slideUp("slow").remove(); }, error: function(data) { @@ -236,9 +235,6 @@ addExternalLinks = function() { $('A[rel="external"]').each(function() { $(this).attr('alt', 'Link opens in new window.'); $(this).attr('title', 'Link opens in new window.'); - }); - $('A[rel="external"]').click(function() { - window.open($(this).attr('href')); - return false; + $(this).attr('target', '_blank'); }); }; -- cgit v1.2.3