GitHub PullRequestReviewCommentEvent at 2014-03-26 20:59:05
Repository: BackNode
Actor: RonanDrouglazet
Payload: {"comment":{"url":"https://api.github.com/repos/silexlabs/BackNode/pulls/comments/10998766","id":10998766,"diff_hunk":"@@ -0,0 +1,179 @@\n+var BackNode = function(iframe) {\n+\tthis.file = null;\n+\tthis.iframe = iframe;\n+\tthis.document = iframe.contentDocument;\n+  this.editor.parent = this;\n+  this.baliseSearch.parent = this;\n+};\n+\n+BackNode.prototype.explorer = {\n+\tpick: function(callback){\n+\t\tcloudExplorer.pick({}, callback);\n+\t},\n+\n+\tsave: function(){\n+\n+\t}\n+};\n+BackNode.prototype.editor = {\n+  /*This method allow the user to modify the \"data-bn\" elements if flagEditable is true. It do the contrary if flagEditable is false */\n+  editable: function(listEditableContent, flagEditable) {\n+    var parent = this.parent;\n+    if (flagEditable === true)\n+    {\n+      /*Need to be uncomment to allow the pictures modification*/\n+      /*$(parent.document).on('click', \"img\", function() {\n+        parent.editor.editPicture($(this));\n+      });*/\n+      for (key in listEditableContent)\n+      {\n+        switch(listEditableContent[key].tagName)\n+        {\n+          case \"img\":\n+            /*maybe we could put something here but we don't have to at this time*/\n+          break;\n+          default:\n+            $(listEditableContent[key]).attr('contenteditable', 'true');\n+          break;\n+        }\n+      }\n+    }\n+    else\n+    {\n+      for (key in listEditableContent)\n+      {\n+        $(listEditableContent[key]).removeAttr('contenteditable');\n+      }\n+    }\n+    // COMMING SOON\n+    //parent.editor.showEditableElements(listEditableContent,flagEditable);\n+    \n+  },/* This method allow the user to modify a picture ( alt and src attribute ) */\n+  editPicture: function(picture) {/*need to be modified, doesn't active now*/\n+      $('#popinPicture').append('<div style=\"width:500px;height:500px;text-align:center;background:#ddd;position:absolute;left:50%;top:50%;margin:-250px 0 0 -250px\"><div style=\"padding:5px;margin-bottom:20px;background-color:#222;color:#eaeaea;display:block;text-align:right\"><span style=\"cursor:pointer;\">Fermer X</span></div><p style=\"margin-left:20px;margin-bottom:20px;display:inline-block;width:150px;text-align:left;\">Picture link</p><p class=\"backNode-imgSrc\" contenteditable=\"true\" style=\"display:inline-block;margin-left:20px;margin-right:20px;margin-bottom:20px;width:200px;background-color:#fff\">' + picture.attr('src') + '</p><div><p style=\"width:150px;text-align:left;margin-left:20px;margin-bottom:20px;display:inline-block;\">Alternative Text</p><p class=\"backNode-imgSrc\" contenteditable=\"true\" style=\"display:inline-block;margin-left:20px;margin-right:20px;margin-bottom:20px;width:200px;background-color:#fff\">' + picture.attr('alt') + '</p></div></div>');\n+      $('#popinPicture').slideDown(400, function() {\n+        $('#popinPicture').on(\"click\", \"span\", function() {\n+          picture.attr('src', $('.backNode-imgSrc').html());\n+          picture.attr('alt', $('.backNode-imgAlt').html());\n+          $('#popinPicture').slideUp(400);\n+        });\n+      });\n+  },\n+  resizeEditableElements: function(elem) {\n+    var top = elem.offset().top;\n+    var left = elem.offset().left;\n+\n+    elem.children('.backnode-editzone').offset({top: top, left: left});\n+    elem.children('.backnode-editzone').css({width: elem.width(), height: elem.height()});\n+  },\n+  showEditableElements: function(listEditableContent, flagEditable){\n+    var edit_zone = '<div style=\"background:#d6ffa0;border:1px solid grey;position:absolute;opacity:0.3\" class=\"backnode-editzone\"></div>';\n+    \n+    var parent = this.parent;\n+    if (flagEditable === true)\n+    {\n+      for (key in listEditableContent)\n+      {\n+        console.log(listEditableContent[key])\n+        $(listEditableContent[key]).append(edit_zone);\n+        if (listEditableContent[key] !== 'undefined'){\n+            parent.editor.resizeEditableElements($(listEditableContent[key]));\n+          }\n+        $(listEditableContent[key]).mouseenter(function() {\n+            $(this).children('.backnode-editzone').hide();\n+        });\n+        $(listEditableContent[key]).mouseleave(function() {\n+            if ($(this).is(\":focus\") === false)\n+            $(this).children('.backnode-editzone').show();\n+        });\n+      }\n+    }\n+    else{\n+      alert(flagEditable)\n+      $('.backnode-editzone').remove();\n+    }\n+  }\n+}\n+\n+\n+BackNode.prototype.baliseSearch = {\n+\n+  getList: function(){\n+    window.test = $(this.parent.document).find('html');\n+    var $dataEdit       = $(this.parent.document).find('[data-bn=\"edit\"]')\n+      , $dataRepeat     = $(this.parent.document).find(\"[data-bn='repeat']\")","path":"public/js/backnode.js","position":104,"original_position":104,"commit_id":"bebc3347416e655a5a4296edc76954c5cf8e4228","original_commit_id":"bebc3347416e655a5a4296edc76954c5cf8e4228","user":{"login":"RonanDrouglazet","id":4659372,"avatar_url":"https://avatars.githubusercontent.com/u/4659372?","gravatar_id":"38cc7869157e291788c41030abe244fd","url":"https://api.github.com/users/RonanDrouglazet","html_url":"https://github.com/RonanDrouglazet","followers_url":"https://api.github.com/users/RonanDrouglazet/followers","following_url":"https://api.github.com/users/RonanDrouglazet/following{/other_user}","gists_url":"https://api.github.com/users/RonanDrouglazet/gists{/gist_id}","starred_url":"https://api.github.com/users/RonanDrouglazet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RonanDrouglazet/subscriptions","organizations_url":"https://api.github.com/users/RonanDrouglazet/orgs","repos_url":"https://api.github.com/users/RonanDrouglazet/repos","events_url":"https://api.github.com/users/RonanDrouglazet/events{/privacy}","received_events_url":"https://api.github.com/users/RonanDrouglazet/received_events","type":"User","site_admin":false},"body":"attention à la syntaxe, je sais pas si vous tirez ça d'un autre langage ou autre mais je suis pas sur que jshint accepte tout, contactez moi et indiquez moi sur quelle branche vous avez des problème de jshint et je vous donnerai un coup de main dans la mesure du possible","created_at":"2014-03-26T20:59:05Z","updated_at":"2014-03-26T20:59:05Z","html_url":"https://github.com/silexlabs/BackNode/pull/1#discussion_r10998766","pull_request_url":"https://api.github.com/repos/silexlabs/BackNode/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/silexlabs/BackNode/pulls/comments/10998766"},"html":{"href":"https://github.com/silexlabs/BackNode/pull/1#discussion_r10998766"},"pull_request":{"href":"https://api.github.com/repos/silexlabs/BackNode/pulls/1"}}}}