Skip to content

Commit c33c4cc

Browse files
committed
Merge branch 'jqueryui'
2 parents edaf1db + 8836986 commit c33c4cc

15 files changed

+5078
-6
lines changed

extension/app/manifest.json

+11-2
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,25 @@
2525
"content_scripts": [
2626
{
2727
"matches": [
28-
"http://*/*",
29-
"https://*/*"
28+
"http://www.facebook.com/*",
29+
"https://www.facebook.com/*"
3030
],
3131
"css": [
32+
"styles/bootstrap.min.css",
3233
"styles/main.css",
3334
"styles/jquery.gridster.css"
3435
],
3536
"js": [
3637
"scripts/jquery-2.0.3.js",
3738
"scripts/jquery.gridster.js",
39+
"scripts/jquery.ui.core.js",
40+
"scripts/jquery.ui.widget.js",
41+
"scripts/jquery.ui.mouse.js",
42+
"scripts/jquery.ui.draggable.js",
43+
"scripts/jquery.ui.droppable.js",
44+
"scripts/jquery.ui.resizable.js",
45+
"scripts/jquery.ui.selectable.js",
46+
"scripts/jquery.ui.sortable.js",
3847
"scripts/contentscript.js"
3948
],
4049
"run_at": "document_end",

extension/app/popup.html

+3-2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
<link href="styles/main.css" rel="stylesheet">
66
<link href="styles/popup.css" rel="stylesheet">
77
<!-- build:js scripts/popup.js -->
8+
<script src="scripts/jquery-2.0.3.js"></script>
89
<script src="scripts/popup.js"></script>
910
<!-- endbuild -->
1011
</head>
@@ -13,9 +14,9 @@
1314
<h1>FB Hack</h1>
1415
<span>click on edit to get started!</span>
1516
<div id="controls">
16-
<button class='btn edit'>Edit</button>
17+
<button class="btn" id="edit">Edit</button>
1718
<br>
18-
<button class='btn save'>Save</button>
19+
<button class="btn" id="save">Save</button>
1920
</div>
2021
</body>
2122
</html>
+121-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,123 @@
11
'use strict';
22

3-
console.log("FB Hack loaded");
3+
console.log("FB Hack Started Loading");
4+
5+
$("._li").addClass("widget_style");
6+
$("._li div").sortable();
7+
$("._li div").disableSelection();
8+
9+
$("#pagelet_bluebar").addClass("draggable ui-widget-content");
10+
$("#pagelet_bluebar").draggable({ snap: "#bottomContent", snapMode: "outer", connectWith: ".widget_style", revert: "invalid"});
11+
$("#pagelet_bluebar").disableSelection();
12+
13+
$('#rightCol').addClass("widget_style");
14+
$("#rightCol div").sortable({connectWith: ".widget_style"});
15+
$("#rightCol div").disableSelection();
16+
17+
$('#leftCol').addClass("widget_style");
18+
$("#leftCol div").sortable({connectWith: ".widget_style"});
19+
$("#leftCol div").disableSelection();
20+
21+
console.log("FB Hack Finished Loading");
22+
/*
23+
pagelet_bluebar
24+
pagelet_welcome_box
25+
pagelet_navigation
26+
pagelet_pinned_nav
27+
pagelet_bookmark_nav
28+
pagelet_friends_online
29+
pagelet_advertiser_panel
30+
pagelet_rhc_ticker
31+
pagelet_reminders
32+
pagelet_ego_pane
33+
pagelet_rhc_footer
34+
pagelet_megaphone
35+
pagelet_composer
36+
pagelet_home_stream
37+
pagelet_stream_pager
38+
pagelet_sidebar
39+
pagelet_ticker
40+
pagelet_dock
41+
ChatTabsPagelet
42+
BuddylistPagelet
43+
*/
44+
45+
var draggables = [
46+
"#pinnedNav", // Favorites
47+
"#pagesNav",
48+
"#groupsNav",
49+
"#appsNav",
50+
"#listsNav",
51+
"#developerNav",
52+
"#interestsNav",
53+
"#pagelet_friends_online",
54+
"#leftCol",
55+
"#rightCol",
56+
"#pagelet_reminders",
57+
"#pagelet_ego_pane",
58+
"#pagelet_rhc_footer",
59+
"#pagelet_composer",
60+
"pagelet_home_stream"
61+
];
62+
63+
var styling = {
64+
"border": "2px dashed #5A9ED6",
65+
"padding": "0",
66+
"cursor": "move",
67+
"margin": "-5px",
68+
"margin-top": "20px"
69+
};
70+
71+
var undoStyling = {
72+
border: "none",
73+
padding: "0",
74+
cursor: "default",
75+
margin: "0"
76+
};
77+
78+
// actually runs on 'edit' button click
79+
$( document ).ready( function(){
80+
chrome.runtime.onMessage.addListener( function(request, sender, sendResponse) {
81+
console.log(sender.tab ? "from a content script:" + sender.tab.url : "from the extension");
82+
if (request.action == "enter") {
83+
sendResponse({farewell: "goodbye"});
84+
enterEditMode();
85+
}
86+
if (request.action == "exit") {
87+
sendResponse({farewell: "goodbye"});
88+
exitEditMode();
89+
}
90+
});
91+
});
92+
93+
function enterEditMode () {
94+
// var iconUrl = chrome.extension.getURL("images/move.png");
95+
// var dragThis = '<div class="dragThis"><img src="' + iconUrl + '" /></div>';
96+
var dragThis = '<div class="dragThis"> X </div>';
97+
// var dragThis = '<div class="dragThis" style="color: white;cursor: move;position: absolute;margin-left: -40px;display: block;background: #03589E;width: 30px;height: 20px;text-align: center;padding-top: 5px;margin-top: -10px;"> X </div>';
98+
var dragThisStyling = {
99+
"color": "white",
100+
"cursor": "move",
101+
"display": "block",
102+
"background": "#03589E",
103+
"width": "30px",
104+
"height": "20px",
105+
"text-align": "center",
106+
"padding-top": "5px",
107+
"float": "right"
108+
};
109+
110+
for (var i = 0; i < draggables.length; i++) {
111+
$(draggables[i]).css(styling);
112+
$(draggables[i]).prepend(dragThis);
113+
};
114+
115+
$('.dragThis').css(dragThisStyling);
116+
}
117+
118+
function exitEditMode () {
119+
for (var i = 0; i < draggables.length; i++) {
120+
$(draggables[i]).css(undoStyling);
121+
}
122+
$('.dragThis').remove();
123+
}

0 commit comments

Comments
 (0)