Since one week I'm looking for a solution to add a folder with a specific icon to the favorites sidebar (like Dropbox does it)
Is there any solution to do this with Electron or Objective C?
What I've found so far:
drag & drop it by yourself
fileicon
Programmatically add a folder to "Places" in Finder (don't know if I can extend electron)
Ok I've found this solution:
On macOS you can find this Folder
~/Library/Application Support/com.apple.sharedfilelist/
It contents some *.sfl files. You can edit them with this tool /usr/bin/sfltool. (It's installed on your mac >= 10.11 El Capitan automatically)
Example to add a folder to your favorites:
/usr/bin/sfltool add-item com.apple.LSSharedFileList.FavoriteItems file:///YOURPATH
I can run this command via require('child_process').exec in my electron app and add a folder icon with the fileicon module. (https://www.npmjs.com/package/fileicon)
This is a little bit dirty, but I don't know an other solution.
[UPDATE]: Read first comment
You can edit the sidebar on Mac using the com.apple.sidebarlists.plist preference file. The items will be in the favoriteitems dictionary.
The items you see are all set to being AlwaysVisible. You need to edit that file to add your own file.
I will give some links that might help you.
About the com.apple.sidebarlists.plist file,
http://www.thexlab.com/faqs/finder.html
Finding the com.apple.finder.plist,
https://discussions.apple.com/thread/4122582
Another post,
https://apple.stackexchange.com/questions/139305/how-can-i-add-new-folders-to-the-favorites-in-the-finder-sidebar
Related
there is a file that i'm working with and the issue is that I want to find where in the entire react app are the instances where the logo file is called. Is there a way to do this?
I've tried finding the direct file path of the svg image
You can do Edit, Find in Files (or Ctrl+Shift+F ) default key binding, Cmd+Shift+F on MacOS) to search the Currently open Folder.
I am using plyr to play YouTube videos. I would like to hide the data-plyr-provider definition from the html file. It is always going to be YouTube.
Currently I am using this code
<div class="container">
<div id="player" data-plyr-provider="youtube" data-plyr-embed-id="somegoogleid"></div>
</div>
<script src='https://web.con/124141/users/plyr/plyr.min.js'></script>
<script>
const player = new Plyr('#player', {});
// Expose player so it can be used from the console
window.player = player;
</script>
What I want to hide is the code in the red box
I was thinking that I can modify plyr.min.js I am using and hardcode the string YouTube but when looking into the code I am not able to do so. I mean I cannot find the right place.
The only reference of data-plyr-provider in the .js I found is this line
attributes: { embed: { provider: "data-plyr-provider", id: "data-plyr-embed-id" } },
Can some one help? Where to modify the code or if there is any other way how to hide plyr.min.js
I'm not sure i really need to write this down here but there is no offical way to pass an attributes directly into Plyr constructor.
So what you can you fork it your own then change the lines like following:
on plyr.js inside src/js/plyr.js
close the lines: #201, #205
and add:
this.provider = 'youtube'; // on line #202
In this way you can create Plyr's from "div" source.
iframe is gonna stay as it is. If you provide iframe it's gonna work as it is.
After all:
npm run build
Create your own build and then use the plyr.min.js from your dist folder with following:
<div id="player" data-plyr-id="https://www.youtube.com/watch?v=SF0w2B6DNUE"></div>
const player = new Plyr('#player');
// Expose player so it can be used from the console
window.player = player;
There you go. An un-offical way to create a plyr specs to youtube online with div creator =)
Update #1:
Just before changes, please checkout to last production build. It may gets broken when you just do it on master branch =)
Update #2:
So since you told me that you don't know how to do it, I'll try to explain.
So first thing first, please go visit https://github.com/sampotts/plyr
Copy the link from image:
After this;
Open a terminal and your code path.
type git clone https://github.com/sampotts/plyr.git
Wait until it's finish and type cd plyr
Install dependencies with npm i
open the current directory with some IDE (can be vscode, sublime or whatever you use for coding.) (code . will open it with VSCode)
After that open the file from the next picture:
Go to line #202 and you wil see following:
On here if you look up you will see this part of code is actually for type div anyway. As you can see there you get the provider from the line #201:
this.provider = this.media.getAttribute(this.config.attributes.embed.provider)
So comment this line(#201) out and add the following to line #202
this.provider = 'youtube';
And also don't forget to comment line #204 which gives us to end result of:
After these changes, (I believe you have node installed)
Save the changes you have made.
Open the terminal again.
checkout the last production build with git checkout v3.6.2
add changes to git via git add .
create a commit with git commit -m "provider set to youtube only"
then build the code with npm run build
After these steps, you will have the builded code from your js and css files from dist folder.
Please Backup your js files before doing following:
Copy the required files from dist/ folder to your server. (plyr.min.js and plyr.css)
After everyting you have done,
You should be able to use everything from top.
I hope you could finally use it =)
Update #3:
Lets also add the dirty way of doing it from #Steve
#Radek, if you go this route, you should go through all the steps if you have time, but if you're looking for something quick and dirty, you can search plyr.min.js for
this.provider=this.media.getAttribute(this.config.attributes.embed.provider),this.media.removeAttribute(this.config.attributes.embed.provider)
and replacing it with
this.provider='youtube'
Is there way, in Atom, to open files that are mentioned in comments?
When I edit a code file, there are often other code files of interest that I may want to also open while working on that file. Sometimes these reference files are miles away and require numerous steps of navigation to open them via the left-pane tree structure.
I was thinking, it would be nice if I could put relative file paths into javascript comments in a manner that atom would understand that if I click that path it should open that file in a new tab.
I suspect this isn't an original idea, so I'm hoping someone can direct me to a solution that enables this type of functionality or make me aware of how it is already enabled but I must use some syntax I'm not currently using.
I found open-project-file and it seems like a nice fit.
Update: I tested it and it works great! You just click on the relative path (whether it is located in code or comment) and by hitting ctrl-shift-o it immediately opens the file in a new tab within the atom editor.
My FTP
Currently looking through my directory of my site build. I'm hoping to edit a LINK , but having trouble finding where the actual pages to edit are.
I can find the link that needs editing (using Chrome/Inspect element) but unable to find the actual document in my FTP. Is there a tab or location that will show me the actual name?
The 'SOURCES' Tab DOES show me file names but that file does not exist in my actual directory.
SOURCES TAB
Chrome/ Inspect Element
Any place I'm not looking?
Thank You!
The easiest way to find any code/link is to download all files in local system and use any IDE to perform "FIND ALL FILES". Following is the way how I tackle this:
Once you installed Notepad++ software, open the Notepad++.
Press Ctrl+F to open the Find and replace tool.
Open Find in files tab. Fill in the Find what: field and select the directory for the search (folder with your site files, template package, theme folder, etc.)
Click on Find all button.
You will see the files and lines with the text you were looking for.
I'm attempting to modify the following file, defaulted by the OpenEDX lms.
account_settings_factory_spec.js
account_settings_view.js
But upon rerunning paver, files aren't changing. Is it actually possible to override the JS in themes? My end goal is to remove the tabs in the account section as well as edit the additional infomation.
Any help towards reaching a solution would be appreciated!
Thanks.
Is it actually possible to override the JS in themes?
yes, tricky
copy & paste from original and edit/modified "account_settings_view.js" and "account_settings_factory.js" to your theme folder
/edx/app/edxapp/themes/my_theme/lms/static/js/student_account/views/account_settings_view.js
/edx/app/edxapp/themes/my_theme/lms/static/js/student_account/views/account_settings_factory.js
and copy(from original) & paste "account_settings.html" to your theme folder
/edx/app/edxapp/themes/my_theme/lms/templates/student_account/account_settings.html
and find this line and edit, this path should be your theme JS path. Check how your custom CSS or JS linked in the header(see image below, "payne" is my theme name).
<%static:require_module module_name="YOUR_THEME/js/student_account/views/account_settings_factory" class_name="AccountSettingsFactory">
I just changed here you can see below. Just added "xxxx" Here I used Docker devstack.