mirror of
https://github.com/not-kennethreitz/convore.json.git
synced 2026-06-16 21:21:00 +00:00
1 line
12 KiB
JSON
1 line
12 KiB
JSON
[{"user_id": 30494, "stars": [], "topic_id": 21803, "date_created": 1304002737.0599589, "message": "in an similar situation I just included kobj-static.js again but inside KBX this means reloading it from Kynetx servers.", "group_id": 236, "id": 842040}, {"user_id": 30494, "stars": [], "topic_id": 21803, "date_created": 1304002630.2809169, "message": "but with chrome inside KBX $K is not available in a dynamically appended element.", "group_id": 236, "id": 842010}, {"user_id": 31361, "stars": [], "topic_id": 21803, "date_created": 1304003671.4781959, "message": "Just a thought... I am not sure if it will work. Let me know if it does, cause I will probably do that also.", "group_id": 236, "id": 842231}, {"user_id": 30494, "stars": [], "topic_id": 21803, "date_created": 1304002538.8311491, "message": "I have this in the emit of a rule : $K('body').prepend('<a href=\"javascript:void(0);\" onclick=\\'console.log($K);\\' >Hi there</a>');", "group_id": 236, "id": 841970}, {"user_id": 30494, "stars": [], "topic_id": 21803, "date_created": 1304002519.74683, "message": "This morning I stumbled on a problem that I thought was only linked to my dynamic js file inclusion fantasies.", "group_id": 236, "id": 841962}, {"user_id": 30494, "stars": [], "topic_id": 21803, "date_created": 1304002584.166038, "message": "works on ktest : http://ktest.heroku.com/a1135x38", "group_id": 236, "id": 841982}, {"user_id": 30494, "stars": [], "topic_id": 21803, "date_created": 1304002762.411114, "message": "and not from cache", "group_id": 236, "id": 842050}, {"user_id": 30494, "stars": [], "topic_id": 21803, "date_created": 1304002914.9538159, "message": "in KBX I can't see where $K comes from ( server js? included in crx?) but there must be a way to reload it again,", "group_id": 236, "id": 842078}, {"user_id": 30494, "stars": [], "topic_id": 21803, "date_created": 1304003633.7978361, "message": "I'll give it a try", "group_id": 236, "id": 842223}, {"user_id": 30494, "stars": [], "topic_id": 21803, "date_created": 1304003839.8425, "message": "doesn't work. I get undefined when I call window.$K later on...", "group_id": 236, "id": 842253}, {"user_id": 30494, "stars": [], "topic_id": 21803, "date_created": 1304003114.6859181, "message": "Should I just include kobj-static.js from the servers again? Is there a way to get the $K from inside the KBX extension? Will this issue be adressed in future KBX releases and what would be the most future friendly solution right now. Thanks!", "group_id": 236, "id": 842118}, {"user_id": 31361, "stars": [], "topic_id": 21803, "date_created": 1304003579.959713, "message": "if you say \"window.$K = $K;\" does that allow $K to be visible to the DOM event that you mentioned above?", "group_id": 236, "id": 842211}, {"user_id": 31361, "stars": [], "topic_id": 21803, "date_created": 1304004365.8704181, "message": "fail... I think that Mike Grace put something about this on StackOverflow... not specifically about the $K obj... but about objects in general and how they work in Chrome and FF.", "group_id": 236, "id": 842368}, {"user_id": 30494, "stars": [], "topic_id": 21803, "date_created": 1304004848.2119219, "message": "Thanks for pointing that. Now that I read his answer again it might look like a general solution that could also apply to $K. I'll test it right now", "group_id": 236, "id": 842457}, {"user_id": 30461, "stars": [], "topic_id": 21803, "date_created": 1304006907.349699, "message": "Thanks. Good for historical purposes if nothing else. :)", "group_id": 236, "id": 842861}, {"user_id": 30461, "stars": [], "topic_id": 21803, "date_created": 1304006859.352469, "message": "Can you put the link of Grace's SO post?", "group_id": 236, "id": 842851}, {"user_id": 30494, "stars": [], "topic_id": 21803, "date_created": 1304006881.9333661, "message": "http://stackoverflow.com/questions/5653090/kynetx-app-not-working-when-installed-via-kbx-extension-on-chrome", "group_id": 236, "id": 842855}, {"user_id": 30494, "stars": [], "topic_id": 21803, "date_created": 1304010686.5611839, "message": "seems like a cool feature, we could stick more js inside kbx extension for developpers to use instead of downloading from servers", "group_id": 236, "id": 843844}, {"user_id": 30494, "stars": [], "topic_id": 21803, "date_created": 1304012355.2311771, "message": "scary", "group_id": 236, "id": 844222}, {"user_id": 30494, "stars": [], "topic_id": 21803, "date_created": 1304010422.904115, "message": "var head = $K(\"head\").get(0); // using jquery\r\n var script1 = document.createElement(\"script\");\r\n script1.src = \"chrome-extension:\\/\\/loddfkkgcpggdfoneofkonkogcfohipk/resources/jquery.js\";\r\n head.appendChild(script1);", "group_id": 236, "id": 843775}, {"user_id": 30494, "stars": [], "topic_id": 21803, "date_created": 1304010559.369261, "message": "where \"loddfkkgcpggdfoneofkonkogcfohipk\" is the local ID of my KBX extension", "group_id": 236, "id": 843813}, {"user_id": 30494, "stars": [], "topic_id": 21803, "date_created": 1304010411.165818, "message": "got a funky solution. Things like this can be done in chrome :", "group_id": 236, "id": 843774}, {"user_id": 30494, "stars": [], "topic_id": 21803, "date_created": 1304010639.8412509, "message": "now the big question is , how can I get this extension id dynamically...", "group_id": 236, "id": 843833}, {"user_id": 30494, "stars": [], "topic_id": 21803, "date_created": 1304012275.5800669, "message": "actually chrome object is available", "group_id": 236, "id": 844202}, {"user_id": 30494, "stars": [], "topic_id": 21803, "date_created": 1304012305.6675169, "message": "and chrome.extension.getURL(\"resources/jquery.js\"); returns \"chrome-extension://loddfkkgcpggdfoneofkonkogcfohipk/resources/jquery.js\"", "group_id": 236, "id": 844210}, {"user_id": 30494, "stars": [], "topic_id": 21803, "date_created": 1304014291.5181291, "message": "allright, time for a break. Conclusion: we can sweetly inject jquery straight from the KBX extension on chrome", "group_id": 236, "id": 844738}, {"user_id": 30494, "stars": [], "topic_id": 21803, "date_created": 1304014478.032337, "message": "end of the monolog", "group_id": 236, "id": 844778}, {"user_id": 30494, "stars": [], "topic_id": 21803, "date_created": 1304014472.440711, "message": "now if someone wants to try to load the runtime like in /page_interaction/page.js ....", "group_id": 236, "id": 844775}, {"user_id": 763, "stars": [{"date_created": 1304031278.776036, "user_id": 30456}], "topic_id": 21803, "date_created": 1304028896.144098, "message": "If you share the original thing you were trying to do, I can help with the 'sandbox safe' way of doing it.", "group_id": 236, "id": 847888}, {"user_id": 763, "stars": [{"date_created": 1304031286.74174, "user_id": 30456}], "topic_id": 21803, "date_created": 1304028632.202635, "message": "I do appreciate the monolog :)", "group_id": 236, "id": 847864}, {"user_id": 763, "stars": [{"date_created": 1304031281.766346, "user_id": 30456}], "topic_id": 21803, "date_created": 1304028767.2612481, "message": "So what you are seeing is not a bug, but rather particularities of the chrome sandbox.", "group_id": 236, "id": 847878}, {"user_id": 763, "stars": [{"date_created": 1304031282.856554, "user_id": 30456}], "topic_id": 21803, "date_created": 1304028724.8621271, "message": "The reason the code behaves differently in the Chrome KBX has to do with the sandbox behavior of Chrome. When you insert an element with an onclick function, that function will exist in the page. The KBX loads the kynetx runtime, which includes $K and other kynetx variables, into the Chrome sandbox to avoid interfereing with the page.", "group_id": 236, "id": 847873}, {"user_id": 763, "stars": [{"date_created": 1304031280.3129821, "user_id": 30456}], "topic_id": 21803, "date_created": 1304028804.8200359, "message": "If you attach an onclick handler via js instead of putting it right into the html of the new dom element, then your onclick handler runs in the chrome sandbox, with $K available.", "group_id": 236, "id": 847883}, {"user_id": 30494, "stars": [], "topic_id": 21803, "date_created": 1305394440.617413, "message": "Here we go. I want to consume some jsonp ( a YQL query) with jQuery.getJSON() . So I am setting the parameter \"jsonpCallback\" which is a string that specifies the callback function, a function that I have declared before. Inside the sandbox, this callback is undefined and the call breaks. How do I make the callback work inside the sandbox? Important detail: my callback uses lots of function I have previously declared, how do I make them available too. I don't mind using a different js library then jQuery.", "group_id": 236, "id": 1053658}, {"user_id": 4291, "stars": [], "topic_id": 21803, "date_created": 1305394670.929899, "message": "Funny you should ask, Windley just tackled this one ... http://www.windley.com/archives/2011/05/dealing_with_jsonp_in_krl_using_the_flickr_api.shtml", "group_id": 236, "id": 1053687}, {"user_id": 30494, "stars": [], "topic_id": 21803, "date_created": 1305394992.698878, "message": "He tackled it in KRL...I need it in pure javascript.... :(", "group_id": 236, "id": 1053733}, {"user_id": 30494, "stars": [], "topic_id": 21803, "date_created": 1305408281.9300129, "message": "Then I dynamically include a script tag containing a temporary callback function like this:\nvar anewscript = document.createElement(\"script\");\nanewscript.type = 'text/javascript';\nanewscript.innerHTML=' callback_tmp= function (mydata){ ' +\n' document.getElementById(\"someElement\").onclick(mydata);' +\n'}';\ndocument.getElementsByTagName(\"head\")[0].appendChild(anewscript);", "group_id": 236, "id": 1054982}, {"user_id": 30494, "stars": [], "topic_id": 21803, "date_created": 1305408502.4468279, "message": "KBX, u make me sweat", "group_id": 236, "id": 1055050}, {"user_id": 30494, "stars": [], "topic_id": 21803, "date_created": 1305408296.1917181, "message": "Then I can make my call to jQuery.getJSON() like this :\n$K.ajaxSetup({ cache: true ,jsonpCallback:'callback_tmp' });\n$K.getJSON(someUrlReturningJSONP);\n\nOnce the requests completes, getJSON calls \"callback_tmp\" that calls the onclick handler \nI mapped to the function in which $K and other stuff are available.\n", "group_id": 236, "id": 1054990}, {"user_id": 30494, "stars": [], "topic_id": 21803, "date_created": 1305408262.3803239, "message": " Here is the solution based on Sam's comment on handlers. \nEvent handlers are available everywhere including the sandbox. \nSo before calling getJSON I nest my callback logic \ninside an onclick handler like this:\ndocument.getElementById('someElement').onclick=function(mydata){ code using available functions & vars at this point, $K ...} ", "group_id": 236, "id": 1054978}, {"user_id": 4291, "stars": [], "topic_id": 21803, "date_created": 1305420512.212698, "message": "Very creative & resourceful solution!", "group_id": 236, "id": 1056696}, {"user_id": 30494, "stars": [], "topic_id": 21803, "date_created": 1305432422.7927141, "message": "@edorcutt : thank you", "group_id": 236, "id": 1057676}, {"user_id": 763, "stars": [], "topic_id": 21803, "date_created": 1305565752.0648749, "message": "jQuery handles jsonp natively. check the docs for getJSON, looking at the jsonp section: http://api.jquery.com/jQuery.getJSON/", "group_id": 236, "id": 1072686}, {"user_id": 763, "stars": [], "topic_id": 21803, "date_created": 1305565696.8255329, "message": "That does work, but you kind of took the long way around.", "group_id": 236, "id": 1072669}, {"user_id": 30494, "stars": [], "topic_id": 21803, "date_created": 1305565869.5851669, "message": "jQuery fails inside KBX in that mode. The specified callback can't be found in chrome. This is a workaround.", "group_id": 236, "id": 1072702}, {"user_id": 763, "stars": [], "topic_id": 21803, "date_created": 1305571149.46369, "message": "ah. righjt", "group_id": 236, "id": 1073374}] |